diff --git a/src/tests_authentik/runner_authentik.py b/src/tests_authentik/runner_authentik.py index 9b7218f..5b19788 100644 --- a/src/tests_authentik/runner_authentik.py +++ b/src/tests_authentik/runner_authentik.py @@ -1,4 +1,4 @@ -from src.runner import Runner +from src.runner import Runner, Test def condition_always_true(dotenv_config: dict[str, str]) -> bool: @@ -12,5 +12,5 @@ def condition_always_false(dotenv_config: dict[str, str]) -> bool: class RunnerAuthentik(Runner): name = "authentik" test_dir_name = "tests_authentik" - main_setup_name = "setup_authentik.py" - # main_test_name = "test_authentik_dummy.py" + setups = [Test(test_file="setup_authentik.py")] + # tests = [Test(test_file="test_authentik_dummy.py")] diff --git a/src/tests_demo/runner_demo.py b/src/tests_demo/runner_demo.py index 310cf93..2957ad5 100644 --- a/src/tests_demo/runner_demo.py +++ b/src/tests_demo/runner_demo.py @@ -1,6 +1,4 @@ -from typing import Optional - -from src.runner import ConditionalTest, Runner +from src.runner import Runner, Test from src.tests_authentik.runner_authentik import RunnerAuthentik @@ -10,20 +8,19 @@ class RunnerDemo(Runner): name: str = "demo" # name of the test, used for logging / output naming test_dir_name: str = "tests_demo" # dir name holding all tests related to RunnerDemo - # Filename of Demo setup. If defined, it will run 1st by executing pytest - main_setup_name: Optional[str] = "setup_demo.py" - - # Filename of Demo test. This file contains unconditional tests that will be run in any - # case. If defined, it will run 2nd by executing pytest - main_test_name: Optional[str] = None - # this indicates that tests from RunnerDemo depend on the setup from RunnerAuthentik. # RunnerDemo will only execute, when setup_authentik.py has finished successfully. # For example, setup_authentik.py generates session states, that can be used as fixtures # that can be loaded from fixtures_authentik.py dependencies: list[type["Runner"]] = [RunnerAuthentik] + # todo: update these comments + # Filename of Demo setup. If defined, it will run 1st by executing pytest + # Filename of Demo test. This file contains unconditional tests that will be run in any + # case. If defined, it will run 2nd by executing pytest # this list can hold many more tests from RunnerDemo that run conditional. The condition # and the test file can be defined by creating a ConditionalTest instance: # ConditionalTest(condition: Callable, test_file: str) - conditional_tests: list[ConditionalTest] = [] + setups: list[Test] = [] + tests: list[Test] = [] + cleanups: list[Test] = [] diff --git a/src/tests_nextcloud/runner_nextcloud.py b/src/tests_nextcloud/runner_nextcloud.py index 36c7bd9..8468815 100644 --- a/src/tests_nextcloud/runner_nextcloud.py +++ b/src/tests_nextcloud/runner_nextcloud.py @@ -1,18 +1,18 @@ -from src.runner import ConditionalTest, Runner +from src.runner import Runner, Test from src.tests_authentik.runner_authentik import RunnerAuthentik -def fake_condition(arg): +def condition_always_false(dotenv_config: dict[str, str]) -> bool: return False class RunnerNextcloud(Runner): name: str = "nextcloud" test_dir_name: str = "tests_nextcloud" - main_setup_name = "setup_nextcloud.py" - main_test_name = "tests_nextcloud.py" - # main_cleanup_name = "cleanup_nextcloud.py" dependencies = [RunnerAuthentik] - conditional_tests: list[ConditionalTest] = [ - ConditionalTest(condition=fake_condition, test_file="tests_nextcloud_onlyoffice.py") + setups = [Test(test_file="setup_nextcloud.py")] + tests = [ + Test(test_file="tests_nextcloud.py"), + Test(condition=condition_always_false, test_file="tests_nextcloud_onlyoffice.py"), ] + # cleanups = [Test(test_file="cleanup_nextcloud.py")] diff --git a/src/tests_wordpress/runner_wordpress.py b/src/tests_wordpress/runner_wordpress.py index 186a554..097a66a 100644 --- a/src/tests_wordpress/runner_wordpress.py +++ b/src/tests_wordpress/runner_wordpress.py @@ -1,4 +1,4 @@ -from src.runner import ConditionalTest, Runner +from src.runner import Runner, Test from src.tests_authentik.runner_authentik import RunnerAuthentik @@ -20,10 +20,9 @@ def condition_has_locale(dotenv_config: dict[str, str]) -> bool: class RunnerWordpress(Runner): name = "wordpress" test_dir_name = "tests_wordpress" - main_setup_name = "setup_wordpress.py" - main_test_name = "test_wordpress.py" dependencies: list[type[Runner]] = [RunnerAuthentik] - conditional_tests = [ - # ConditionalTest(condition=condition_has_locale, test_file="test_wordpress_localization.py"), + setups = [Test(test_file="setup_wordpress.py")] + tests = [ + Test(test_file="test_wordpress.py"), + Test(condition=condition_has_locale, test_file="test_wordpress_localization.py"), ] - prevent_skip = True