rename tests_dir to output_dir

This commit is contained in:
Daniel 2023-11-24 18:13:49 +01:00
parent 3354859ec1
commit 8418e5aeb1
3 changed files with 12 additions and 12 deletions

View file

@ -21,7 +21,7 @@ def pytest_addoption(parser):
action="store", action="store",
) )
parser.addoption( parser.addoption(
"--tests_dir", "--output_dir",
action="store", action="store",
) )
parser.addoption( parser.addoption(
@ -32,12 +32,12 @@ def pytest_addoption(parser):
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(scope="session", autouse=True)
def dirmanager(request) -> DirManager: def dirmanager(request) -> DirManager:
tests_dir = request.config.getoption("--tests_dir") output_dir = request.config.getoption("--output_dir")
assert tests_dir is not None, "required pytest command line argument not given" assert output_dir is not None, "required pytest command line argument not given"
tests_dir = Path(tests_dir) output_dir = Path(output_dir)
session_id = request.config.getoption("--session_id") session_id = request.config.getoption("--session_id")
assert session_id is not None, "required pytest command line argument not given" assert session_id is not None, "required pytest command line argument not given"
dirmanager = DirManager(output_dir=tests_dir, session_id=session_id) dirmanager = DirManager(output_dir=output_dir, session_id=session_id)
dirmanager.create_all_dirs() dirmanager.create_all_dirs()
return dirmanager return dirmanager

View file

@ -20,12 +20,12 @@ class Runner:
sub_tests: list[SubTest] = [] sub_tests: list[SubTest] = []
dependencies: list[str] = [] dependencies: list[str] = []
def __init__(self, dotenv_path: Path, tests_dir: Path, session_id: str): def __init__(self, dotenv_path: Path, output_dir: Path, session_id: str):
self.dotenv_path = dotenv_path self.dotenv_path = dotenv_path
self.config: dict[str, str] = dotenv_values(dotenv_path) # type: ignore self.config: dict[str, str] = dotenv_values(dotenv_path) # type: ignore
self.tests_dir = tests_dir self.output_dir = output_dir
self.session_id = session_id self.session_id = session_id
self.dir_manager = DirManager(tests_dir, session_id) self.dir_manager = DirManager(output_dir, session_id)
ic(f"creating instance of {self.__class__.__name__}") ic(f"creating instance of {self.__class__.__name__}")
assert self.test_dir_name is not None assert self.test_dir_name is not None
@ -55,8 +55,8 @@ class Runner:
command_arguments.append("--env_file") command_arguments.append("--env_file")
command_arguments.append(str(self.dotenv_path)) command_arguments.append(str(self.dotenv_path))
command_arguments.append("--tests_dir") command_arguments.append("--output_dir")
command_arguments.append(str(self.tests_dir)) command_arguments.append(str(self.output_dir))
command_arguments.append("--session_id") command_arguments.append("--session_id")
command_arguments.append(self.session_id) command_arguments.append(self.session_id)

View file

@ -10,7 +10,7 @@ from src.tests_wordpress.runner_wordpress import RunnerWordpress
class TestRunner(Protocol): class TestRunner(Protocol):
def __init__(self, dotenv_path: Path, tests_dir: Path, session_id: str): def __init__(self, dotenv_path: Path, output_dir: Path, session_id: str):
... ...
def run_setup(self): def run_setup(self):
@ -50,7 +50,7 @@ class Wrapper:
for env_file in env_files: for env_file in env_files:
config: dict[str, str] = dotenv_values(env_file) # type: ignore config: dict[str, str] = dotenv_values(env_file) # type: ignore
RunnerClass = RUNNER_DICT[config["TYPE"]] RunnerClass = RUNNER_DICT[config["TYPE"]]
runners.append(RunnerClass(dotenv_path=env_file, tests_dir=self.output_dir, session_id=self.session_id)) runners.append(RunnerClass(dotenv_path=env_file, output_dir=self.output_dir, session_id=self.session_id))
return runners return runners
@staticmethod @staticmethod