typing and docs

This commit is contained in:
Daniel 2023-12-02 15:39:36 +01:00
parent a86a830c08
commit 65f1238916

View file

@ -22,7 +22,7 @@ RUNNER_DICT: dict[str, type[Runner]] = {
class Coordinator:
def __init__(self, env_paths_list: list[Path], output_dir: Path, session_id: str):
def __init__(self, env_paths_list: list[Path], output_dir: Path, session_id: str) -> None:
out_string = "".join([e.name + "\n" for e in env_paths_list])
out_string += f"output_dir = {output_dir}\n"
out_string += f"session_id = {session_id}"
@ -55,19 +55,19 @@ class Coordinator:
print("dependency", dependency.name)
exit()
def setup_test(self):
def setup_test(self) -> None:
logger.info("calling setup_test()")
self.DIR.create_all_dirs()
self._copy_env_files()
def _copy_env_files(self):
def _copy_env_files(self) -> None:
"""Copies all env files to STATES/env_files. Files will be renamed to their own TYPE value."""
env_files_dir = self.DIR.STATES / "env_files"
env_files_dir.mkdir(exist_ok=True)
for env_file in self.env_files:
shutil.copy(env_file.env_path, env_files_dir / env_file.env_type)
def run_test(self):
def run_test(self) -> None:
logger.info("calling run_test()")
self.runners: list[Runner] = self._load_runners(self.env_files)
for runner in self.runners:
@ -79,6 +79,7 @@ class Coordinator:
logger.info("run_test() finished")
def _load_runners(self, env_files: list[EnvFile]) -> list[Runner]:
"""Creates an instance of the correct Runner class for each given env file"""
runners = []
for env_file in env_files:
RunnerClass = RUNNER_DICT[env_file.config["TYPE"]]
@ -87,7 +88,8 @@ class Coordinator:
)
return runners
def combine_html(self):
def combine_html(self) -> None:
"""combines all generated pytest html reports into one"""
in_path = str(self.DIR.RECORDS / "html")
out_path = str(self.DIR.RECORDS / "full-report.html")
title = "combined.html"