refactoring and cleanup

This commit is contained in:
Daniel 2023-11-21 21:54:25 +01:00
parent 224ad2ea85
commit 534eb229c9

View file

@ -17,24 +17,19 @@ RUNNER_DICT: dict[str, type[TestRunner]] = {"wordpress": RunnerWordpress}
class TestWrapper: class TestWrapper:
def __init__(self, dotenv_path: Path): def __init__(self, dotenv_path: Path):
self.dotenv_path = dotenv_path self.dotenv_path = dotenv_path
self.root_dir = self.dotenv_path.parent self.config = self.load_config_from_dotenv(dotenv_path)
self.show_files() runner = self.load_runner()
self.load_dotenv() runner.run_tests()
self.load_test_wrapper()
def show_files(self): def load_config_from_dotenv(self, dotenv_path: Path):
ic(list(self.root_dir.glob("*"))) assert dotenv_path.is_file()
return dotenv_values(self.dotenv_path)
def load_dotenv(self): def load_runner(self):
assert self.dotenv_path.is_file()
self.config = dotenv_values(self.dotenv_path)
def load_test_wrapper(self):
config_type = self.config["TYPE"] config_type = self.config["TYPE"]
ic(config_type) ic(config_type)
RunnerClass = RUNNER_DICT[config_type] RunnerClass = RUNNER_DICT[config_type]
runner = RunnerClass(self.dotenv_path) return RunnerClass(self.dotenv_path)
runner.run_tests()
if __name__ == "__main__": if __name__ == "__main__":