move ENV_Files to main.py

This commit is contained in:
Daniel 2023-11-24 17:56:11 +01:00
parent f9baecba30
commit 0a977abf65
2 changed files with 14 additions and 12 deletions

15
main.py
View file

@ -1,11 +1,22 @@
import os
from pathlib import Path
from src.utils import get_session_id
from src.wrapper import ENV_FILES, Wrapper
from src.wrapper import Wrapper
ENV_FILES = [
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
# Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
]
TESTS_DIR = Path("./tests").resolve()
# Set environment variables
os.environ["PWDEBUG"] = "1"
# os.environ["PWDEBUG"] = "1"
os.environ["TESTS_DIR"] = str(TESTS_DIR)
session_id = get_session_id()
wrapper = Wrapper(ENV_FILES, session_id=session_id)

View file

@ -1,21 +1,12 @@
from datetime import datetime
from pathlib import Path
from typing import Protocol
from dotenv import dotenv_values
from icecream import ic
from src.dirmanager import DirManager
from src.tests_authentik.runner_authentik import RunnerAuthentik
from src.tests_wordpress.runner_wordpress import RunnerWordpress
TESTS_DIR = Path("./tests").resolve()
ENV_FILES = [
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
# Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
]
class TestRunner(Protocol):
def __init__(self, dotenv_path: Path, tests_dir: Path, session_id: str):
@ -55,7 +46,7 @@ class Wrapper:
def _load_runners(self, env_files: list[Path]) -> list[TestRunner]:
runners = []
for env_file in env_files:
config: dict[str, str] = dotenv_values(env_file)
config: dict[str, str] = dotenv_values(env_file) # type: ignore
RunnerClass = RUNNER_DICT[config["TYPE"]]
runners.append(RunnerClass(dotenv_path=env_file, tests_dir=TESTS_DIR, session_id=self.session_id))
return runners