restructure Wrapper, update TestRunner protocol
This commit is contained in:
parent
ea51e508d7
commit
f865cda6b4
1 changed files with 11 additions and 9 deletions
20
src/main.py
20
src/main.py
|
|
@ -17,7 +17,7 @@ ENV_FILES = [
|
|||
|
||||
|
||||
class TestRunner(Protocol):
|
||||
def __init__(self, dotenv_path: Path):
|
||||
def __init__(self, dotenv_path: Path, tests_dir: Path, session_id: str):
|
||||
...
|
||||
|
||||
def run_tests(self):
|
||||
|
|
@ -32,17 +32,14 @@ RUNNER_DICT: dict[str, type[TestRunner]] = {
|
|||
|
||||
|
||||
class Wrapper:
|
||||
def __init__(self, env_files: list[Path]):
|
||||
def __init__(self, env_files: list[Path], session_id: str):
|
||||
self.env_files = env_files
|
||||
self.check_env_files(self.env_files)
|
||||
self.session_id = session_id
|
||||
|
||||
session_id = self.get_session_id()
|
||||
self.setup_test(session_id)
|
||||
|
||||
self.run_test()
|
||||
|
||||
def setup_test(self, session_id: str):
|
||||
self.dir_manager = DirManager(tests_dir=TESTS_DIR, session_id=session_id)
|
||||
def setup_test(self):
|
||||
self.dir_manager = DirManager(tests_dir=TESTS_DIR, session_id=self.session_id)
|
||||
self.dir_manager.create_all_dirs()
|
||||
|
||||
def run_test(self):
|
||||
|
|
@ -55,6 +52,7 @@ class Wrapper:
|
|||
config: dict[str, str] = dotenv_values(env_file)
|
||||
RunnerClass = RUNNER_DICT[config["TYPE"]]
|
||||
runners.append(RunnerClass(env_file))
|
||||
RunnerClass(dotenv_path=env_file, tests_dir=TESTS_DIR, session_id=)
|
||||
return runners
|
||||
|
||||
def run_tests(self, runners: list[TestRunner]):
|
||||
|
|
@ -74,4 +72,8 @@ class Wrapper:
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
t = Wrapper(ENV_FILES)
|
||||
session_id = Wrapper.get_session_id()
|
||||
wrapper = Wrapper(ENV_FILES)
|
||||
wrapper.setup_test()
|
||||
wrapper.run_test()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue