add main setup
This commit is contained in:
parent
befad97cc1
commit
826e400150
2 changed files with 11 additions and 4 deletions
|
|
@ -15,6 +15,7 @@ class SubTest(TypedDict):
|
||||||
|
|
||||||
class Runner:
|
class Runner:
|
||||||
test_dir_name: Optional[str] = None
|
test_dir_name: Optional[str] = None
|
||||||
|
main_setup_name: Optional[str] = None
|
||||||
main_test_name: Optional[str] = None
|
main_test_name: Optional[str] = None
|
||||||
sub_tests: list[SubTest] = []
|
sub_tests: list[SubTest] = []
|
||||||
dependencies: list[str] = []
|
dependencies: list[str] = []
|
||||||
|
|
@ -31,9 +32,12 @@ class Runner:
|
||||||
self.root_dir = Path(__file__).parent
|
self.root_dir = Path(__file__).parent
|
||||||
|
|
||||||
def _run_main_test(self):
|
def _run_main_test(self):
|
||||||
|
if isinstance(self.main_setup_name, str):
|
||||||
|
full_path = self.root_dir / self.test_dir_name / self.main_setup_name
|
||||||
|
self._run_pytest(full_path)
|
||||||
if isinstance(self.main_test_name, str):
|
if isinstance(self.main_test_name, str):
|
||||||
full_test_path = self.root_dir / self.test_dir_name / self.main_test_name
|
full_path = self.root_dir / self.test_dir_name / self.main_test_name
|
||||||
self._run_pytest(full_test_path)
|
self._run_pytest(full_path)
|
||||||
|
|
||||||
def _run_pytest(self, full_test_path: Path):
|
def _run_pytest(self, full_test_path: Path):
|
||||||
"""runs pytest programmatically
|
"""runs pytest programmatically
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from src.runner import Runner, SubTest
|
from src.runner import Runner, SubTest
|
||||||
from src.tests_authentik.setup_authentik import setup_authentik
|
|
||||||
|
# from src.tests_authentik.setup_authentik import setup_authentik
|
||||||
|
|
||||||
|
|
||||||
def condition_always_true(dotenv_path: Path) -> bool:
|
def condition_always_true(dotenv_path: Path) -> bool:
|
||||||
|
|
@ -14,8 +15,10 @@ def condition_always_false(dotenv_path: Path) -> bool:
|
||||||
|
|
||||||
class RunnerAuthentik(Runner):
|
class RunnerAuthentik(Runner):
|
||||||
test_dir_name = "tests_authentik"
|
test_dir_name = "tests_authentik"
|
||||||
|
main_setup_name = "setup_authentik.py"
|
||||||
main_test_name = "test_authentik_dummy.py"
|
main_test_name = "test_authentik_dummy.py"
|
||||||
|
|
||||||
def run_setup(self):
|
def run_setup(self):
|
||||||
# run setup
|
# run setup
|
||||||
setup_authentik(self.config, self.dir_manager.STATES)
|
# setup_authentik(self.config, self.dir_manager.STATES)
|
||||||
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue