more refactoring

This commit is contained in:
Daniel 2023-12-11 12:03:31 +01:00
parent a4d99a2e7d
commit 131477557d

View file

@ -114,7 +114,8 @@ class Runner:
status = cls.exit_code_to_str(status) status = cls.exit_code_to_str(status)
# remove matching files # remove matching files
[f.unlink() for f in DIR.STATUS.glob("*") if identifier_string in f.name] for status_file in cls._get_status_files(DIR, identifier_string):
status_file.unlink()
full_name = cls.combine_names(status, identifier_string) full_name = cls.combine_names(status, identifier_string)
file_path = DIR.STATUS / full_name file_path = DIR.STATUS / full_name
@ -122,10 +123,14 @@ class Runner:
pass # create empty file pass # create empty file
@staticmethod @staticmethod
def _is_test_passed(DIR: "DirManager", identifier_string: str) -> bool: def _get_status_files(DIR: "DirManager", identifier_string: str) -> list[Path]:
return [f for f in DIR.STATUS.glob("*") if identifier_string in f.name]
@classmethod
def _is_test_passed(cls, DIR: "DirManager", identifier_string: str) -> bool:
"""returns True if the selected test matching identifier_string already passed""" """returns True if the selected test matching identifier_string already passed"""
matching_files = [f for f in DIR.STATUS.glob("*") if identifier_string in f.name] matching_files = cls._get_status_files(DIR, identifier_string)
if len(matching_files) == 1: if len(matching_files) == 1:
status_file = matching_files[0] status_file = matching_files[0]
if "passed" in status_file.name: if "passed" in status_file.name: