new test framework #1
1 changed files with 8 additions and 13 deletions
|
|
@ -17,24 +17,19 @@ RUNNER_DICT: dict[str, type[TestRunner]] = {"wordpress": RunnerWordpress}
|
|||
class TestWrapper:
|
||||
def __init__(self, dotenv_path: Path):
|
||||
self.dotenv_path = dotenv_path
|
||||
self.root_dir = self.dotenv_path.parent
|
||||
self.show_files()
|
||||
self.load_dotenv()
|
||||
self.load_test_wrapper()
|
||||
self.config = self.load_config_from_dotenv(dotenv_path)
|
||||
runner = self.load_runner()
|
||||
runner.run_tests()
|
||||
|
||||
def show_files(self):
|
||||
ic(list(self.root_dir.glob("*")))
|
||||
def load_config_from_dotenv(self, dotenv_path: Path):
|
||||
assert dotenv_path.is_file()
|
||||
return dotenv_values(self.dotenv_path)
|
||||
|
||||
def load_dotenv(self):
|
||||
assert self.dotenv_path.is_file()
|
||||
self.config = dotenv_values(self.dotenv_path)
|
||||
|
||||
def load_test_wrapper(self):
|
||||
def load_runner(self):
|
||||
config_type = self.config["TYPE"]
|
||||
ic(config_type)
|
||||
RunnerClass = RUNNER_DICT[config_type]
|
||||
runner = RunnerClass(self.dotenv_path)
|
||||
runner.run_tests()
|
||||
return RunnerClass(self.dotenv_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue