make-all-env-files-available #4

Merged
dan merged 6 commits from make-all-env-files-available into dev 2023-11-30 10:53:22 +01:00
Showing only changes of commit d98de31d35 - Show all commits

View file

@ -35,26 +35,26 @@ class Runner:
def _run_main_setup_and_test(self):
if isinstance(self.main_setup_name, str):
self._run_test_if_required(
self._run_or_skip_test(
identifier_string=self.combine_names(self.name, self.main_setup_name),
test_path=self.root_dir / self.test_dir_name / self.main_setup_name,
)
if isinstance(self.main_test_name, str):
self._run_test_if_required(
self._run_or_skip_test(
identifier_string=self.combine_names(self.name, self.main_test_name),
test_path=self.root_dir / self.test_dir_name / self.main_test_name,
)
def _run_test_if_required(self, identifier_string: str, test_path: Path):
if not self.prevent_skip and self._test_already_passed(identifier_string, remove_existing=True):
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}")
else:
logger.info(f"running {identifier_string}")
result = self._call_pytest(test_path)
self._create_result_file(result=result, identifier_string=identifier_string)
def _test_already_passed(self, identifier_string: str, remove_existing: bool = False) -> bool:
def _is_test_passed(self, identifier_string: str, remove_existing: bool = False) -> bool:
"""returns True if the selected test (matching test_name + sub_test_name) already passed
This is determined by the presence of a specific output file in the RESULTS folder that
@ -125,7 +125,7 @@ class Runner:
identifier_string = self.combine_names(self.name, sub_test_name)
if condition_function(self.config):
test_path = self.root_dir / self.test_dir_name / sub_test_name
self._run_test_if_required(identifier_string=identifier_string, test_path=test_path)
self._run_or_skip_test(identifier_string=identifier_string, test_path=test_path)
else:
self._create_result_file(result=-1, identifier_string=identifier_string)