add output dir as argument to wrapper
This commit is contained in:
parent
349f2a510a
commit
26f5b34279
2 changed files with 7 additions and 6 deletions
5
main.py
5
main.py
|
|
@ -10,13 +10,12 @@ ENV_FILES = [
|
||||||
# Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
# Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
||||||
]
|
]
|
||||||
|
|
||||||
TESTS_DIR = Path("./tests").resolve()
|
OUTPUT_DIR = Path("./test-output").resolve()
|
||||||
|
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
|
|
||||||
# os.environ["PWDEBUG"] = "1"
|
# os.environ["PWDEBUG"] = "1"
|
||||||
os.environ["TESTS_DIR"] = str(TESTS_DIR)
|
|
||||||
|
|
||||||
cred_file = Path("credentials.json")
|
cred_file = Path("credentials.json")
|
||||||
with open(cred_file, "r") as f:
|
with open(cred_file, "r") as f:
|
||||||
|
|
@ -27,6 +26,6 @@ os.environ["ADMIN_PASS"] = CREDENTIALS["admin_pass"]
|
||||||
|
|
||||||
|
|
||||||
session_id = get_session_id()
|
session_id = get_session_id()
|
||||||
wrapper = Wrapper(ENV_FILES, session_id=session_id)
|
wrapper = Wrapper(ENV_FILES, output_dir=OUTPUT_DIR, session_id=session_id)
|
||||||
wrapper.setup_test()
|
wrapper.setup_test()
|
||||||
wrapper.run_test()
|
wrapper.run_test()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Protocol
|
from typing import Protocol
|
||||||
|
|
||||||
|
|
@ -27,13 +28,14 @@ RUNNER_DICT: dict[str, type[TestRunner]] = {
|
||||||
|
|
||||||
|
|
||||||
class Wrapper:
|
class Wrapper:
|
||||||
def __init__(self, env_files: list[Path], session_id: str):
|
def __init__(self, env_files: list[Path], output_dir: Path, session_id: str):
|
||||||
self.env_files = env_files
|
self.env_files = env_files
|
||||||
self.check_env_files(self.env_files)
|
self.check_env_files(self.env_files)
|
||||||
|
self.output_dir = output_dir
|
||||||
self.session_id = session_id
|
self.session_id = session_id
|
||||||
|
|
||||||
def setup_test(self):
|
def setup_test(self):
|
||||||
self.dir_manager = DirManager(tests_dir=TESTS_DIR, session_id=self.session_id)
|
self.dir_manager = DirManager(output_dir=self.output_dir, session_id=self.session_id)
|
||||||
self.dir_manager.create_all_dirs()
|
self.dir_manager.create_all_dirs()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
@ -48,7 +50,7 @@ class Wrapper:
|
||||||
for env_file in env_files:
|
for env_file in env_files:
|
||||||
config: dict[str, str] = dotenv_values(env_file) # type: ignore
|
config: dict[str, str] = dotenv_values(env_file) # type: ignore
|
||||||
RunnerClass = RUNNER_DICT[config["TYPE"]]
|
RunnerClass = RUNNER_DICT[config["TYPE"]]
|
||||||
runners.append(RunnerClass(dotenv_path=env_file, tests_dir=TESTS_DIR, session_id=self.session_id))
|
runners.append(RunnerClass(dotenv_path=env_file, tests_dir=self.output_dir, session_id=self.session_id))
|
||||||
return runners
|
return runners
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue