add more args to condition function, add ConditionArgs, homogenize attribute names

This commit is contained in:
Daniel 2023-12-08 12:29:02 +01:00
parent 65aed3e31f
commit 8c500da277
5 changed files with 39 additions and 24 deletions

View file

@ -1,16 +1,17 @@
import shutil
from pathlib import Path
from typing import NamedTuple
from typing import TYPE_CHECKING, NamedTuple
from dotenv import dotenv_values
from pytest_abra.dir_manager import DirManager
from pytest_abra.runner import Runner
if TYPE_CHECKING:
from pytest_abra.dir_manager import DirManager
from pytest_abra.runner import Runner
class EnvFile(NamedTuple):
env_path: Path
config: dict[str, str]
env_config: dict[str, str]
env_type: str
def __repr__(self) -> str:
@ -37,7 +38,7 @@ class EnvManager:
config: dict[str, str] = dotenv_values(env_path) # type: ignore
assert "TYPE" in config, f"the env file {env_path} does not specify the required TYPE key."
env_type = config["TYPE"]
env_files.append(EnvFile(env_path=env_path, config=config, env_type=env_type))
env_files.append(EnvFile(env_path=env_path, env_config=config, env_type=env_type))
return env_files
@staticmethod
@ -92,7 +93,7 @@ class EnvManager:
"Could not resolve test order. This is possibly due to a circular dependency (a on b, b on c, c on a)"
)
def copy_env_files(self, DIR: DirManager) -> None:
def copy_env_files(self, DIR: "DirManager") -> None:
"""Copies all env files to STATES/env_files. Files will be renamed to
<index>-<env_type>-<original_name>
00-authentik-login.test.dev.local-it.cloud.env"""