improve dir creation
This commit is contained in:
parent
f277d95f2c
commit
18c695d178
1 changed files with 11 additions and 9 deletions
20
src/main.py
20
src/main.py
|
|
@ -7,7 +7,7 @@ from icecream import ic
|
||||||
from tests_authentik.runner_authentik import RunnerAuthentik
|
from tests_authentik.runner_authentik import RunnerAuthentik
|
||||||
from tests_wordpress.runner_wordpress import RunnerWordpress
|
from tests_wordpress.runner_wordpress import RunnerWordpress
|
||||||
|
|
||||||
TESTS_DIR = Path("tests")
|
TESTS_DIR = Path("../tests")
|
||||||
|
|
||||||
ENV_FILES = [
|
ENV_FILES = [
|
||||||
Path("../envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
Path("../envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
||||||
|
|
@ -32,6 +32,7 @@ RUNNER_DICT: dict[str, type[TestRunner]] = {"wordpress": RunnerWordpress}
|
||||||
class Wrapper:
|
class Wrapper:
|
||||||
def __init__(self, env_files: list[Path]):
|
def __init__(self, env_files: list[Path]):
|
||||||
self.env_files = env_files
|
self.env_files = env_files
|
||||||
|
self.runners: list[TestRunner] = []
|
||||||
|
|
||||||
self.setup_tests()
|
self.setup_tests()
|
||||||
return
|
return
|
||||||
|
|
@ -42,9 +43,17 @@ class Wrapper:
|
||||||
runner = self.load_runners(config, dotenv_path)
|
runner = self.load_runners(config, dotenv_path)
|
||||||
runner.run_tests()
|
runner.run_tests()
|
||||||
|
|
||||||
|
def load_runners(self, config: dict[str, str], dotenv_path: Path) -> TestRunner:
|
||||||
|
config_type = config["TYPE"]
|
||||||
|
ic(config_type)
|
||||||
|
RunnerClass = RUNNER_DICT[config_type]
|
||||||
|
return RunnerClass(dotenv_path)
|
||||||
|
|
||||||
def setup_tests(self):
|
def setup_tests(self):
|
||||||
session_id = self.get_session_id()
|
session_id = self.get_session_id()
|
||||||
test_dir = self.create_test_dir(session_id)
|
test_dir = self.create_test_dir(session_id)
|
||||||
|
self.create_records_dir(test_dir)
|
||||||
|
self.create_states_dir(test_dir)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_session_id() -> str:
|
def get_session_id() -> str:
|
||||||
|
|
@ -70,13 +79,6 @@ class Wrapper:
|
||||||
states.mkdir()
|
states.mkdir()
|
||||||
return states
|
return states
|
||||||
|
|
||||||
def load_runners(self, config: dict[str, str], dotenv_path: Path) -> TestRunner:
|
|
||||||
config_type = config["TYPE"]
|
|
||||||
ic(config_type)
|
|
||||||
RunnerClass = RUNNER_DICT[config_type]
|
|
||||||
return RunnerClass(dotenv_path)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dotenv_path = Path(__file__).parent / "./blog.dev.local-it.cloud.env"
|
t = Wrapper(ENV_FILES)
|
||||||
t = Wrapper(dotenv_path)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue