add dependency check

This commit is contained in:
Daniel 2023-11-24 23:40:08 +01:00
parent 3b7c56a5b3
commit 6bceee946a
3 changed files with 15 additions and 0 deletions

View file

@ -14,6 +14,7 @@ class SubTest(TypedDict):
class Runner:
name: Optional[str] = None
test_dir_name: Optional[str] = None
main_setup_name: Optional[str] = None
main_test_name: Optional[str] = None
@ -85,6 +86,7 @@ class Runner:
ic(list(self.root_dir.glob("*")))
def run_tests(self):
self._check_dependencies()
self._run_main_test()
for sub_test in self.sub_tests:
condition_function = sub_test["condition"]
@ -92,3 +94,14 @@ class Runner:
test_name = sub_test["test_file"]
full_test_path = self.root_dir / self.test_dir_name / test_name
self._run_pytest(full_test_path)
self._create_complete_file()
def _create_complete_file(self):
file_path = self.dir_manager.RESULTS / self.name
with open(file_path, "w") as _:
pass # pass does nothing, so the file remains empty
def _check_dependencies(self):
for dependencie in self.dependencies:
ic(f"checking {dependencie}")
assert dependencie in self.dir_manager.RESULTS.glob("*")

View file

@ -14,6 +14,7 @@ def condition_always_false(dotenv_path: Path) -> bool:
class RunnerAuthentik(Runner):
name = "authentik"
test_dir_name = "tests_authentik"
main_setup_name = "setup_authentik.py"
# main_test_name = "test_authentik_dummy.py"

View file

@ -12,6 +12,7 @@ def condition_always_false(dotenv_path: Path) -> bool:
class RunnerWordpress(Runner):
name = "wordpress"
test_dir_name = "tests_wordpress"
# main_test_name = "test_wordpress.py"
sub_tests = [