add cleanup routine to runner and coordinator
This commit is contained in:
parent
2e33f8f014
commit
cb6544f5aa
2 changed files with 11 additions and 0 deletions
|
|
@ -59,6 +59,8 @@ class Coordinator:
|
|||
self.runners: list[Runner] = self._load_runners(self.env_paths.values())
|
||||
for runner in self.runners:
|
||||
runner.run_tests()
|
||||
for runner in self.runners:
|
||||
runner.run_cleanup()
|
||||
logger.info("run_test() finished")
|
||||
|
||||
def _load_runners(self, env_files: list[Path]) -> list[Runner]:
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Runner:
|
|||
test_dir_name: str = ""
|
||||
main_setup_name: Optional[str] = None
|
||||
main_test_name: Optional[str] = None
|
||||
main_cleanup_name: Optional[str] = None
|
||||
dependencies: list[type["Runner"]] = []
|
||||
sub_tests: list[SubTest] = []
|
||||
prevent_skip = False
|
||||
|
|
@ -62,6 +63,14 @@ class Runner:
|
|||
else:
|
||||
self._create_result_file(result=-1, identifier_string=identifier_string)
|
||||
|
||||
def run_cleanup(self):
|
||||
if isinstance(self.main_cleanup_name, str):
|
||||
identifier_string = self.combine_names(self.name, self.main_cleanup_name)
|
||||
test_path = self.root_dir / self.test_dir_name / self.main_cleanup_name
|
||||
logger.info(f"running {identifier_string}")
|
||||
result = self._call_pytest(test_path)
|
||||
self._create_result_file(result=result, identifier_string=identifier_string)
|
||||
|
||||
def _run_or_skip_test(self, identifier_string: str, test_path: Path):
|
||||
if not self.prevent_skip and self._is_test_passed(identifier_string, remove_existing=True):
|
||||
logger.info(f"skipping {identifier_string}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue