initial commit

This commit is contained in:
Daniel 2023-11-21 15:20:43 +01:00
parent b84bd80842
commit 9411fe61ee
11 changed files with 272 additions and 1 deletions

42
src/test_wrapper.py Normal file
View file

@ -0,0 +1,42 @@
from pathlib import Path
from typing import Protocol
from dotenv import dotenv_values
from icecream import ic
from tests_wordpress.testrunner_wordpress import TestRunnerWordpress
class TestRunner(Protocol):
def run_tests():
pass
WRAPPER_DICT: dict[str, type[TestRunner]] = {"wordpress": TestRunnerWordpress}
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()
def show_files(self):
ic(list(self.root_dir.glob("*")))
def load_dotenv(self):
assert self.dotenv_path.is_file()
self.config = dotenv_values(self.dotenv_path)
def load_test_wrapper(self):
config_type = self.config["TYPE"]
ic(config_type)
WrapperClass = WRAPPER_DICT[config_type]
wrapper = WrapperClass(self.dotenv_path)
wrapper.run_tests()
if __name__ == "__main__":
dotenv_path = Path(__file__).parent / "./blog.dev.local-it.cloud.env"
t = TestWrapper(dotenv_path)