From 01c294d44b231c93651946ad7c5092140d5437e6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:18:17 +0100 Subject: [PATCH] rename src to abratest --- {src => abratest}/__init__.py | 0 {src => abratest}/coordinator.py | 12 ++++++------ {src => abratest}/dir_manager.py | 0 {src => abratest}/env_manager.py | 6 +++--- {src => abratest}/html_helper.py | 0 {src => abratest}/plugin-abra.py | 4 ++-- {src => abratest}/runner.py | 4 ++-- {src => abratest}/runner_dict.py | 8 ++++---- {src => abratest}/runner_manager.py | 2 +- {src => abratest}/utils.py | 0 main.py | 10 +++++----- previous-work/wordpress_test.py | 2 +- .../authentik/tests_authentik/fixtures_authentik.py | 2 +- .../authentik/tests_authentik/runner_authentik.py | 2 +- recipes/authentik/tests_authentik/setup_authentik.py | 4 ++-- recipes/demo/tests_demo/fixtures_demo.py | 4 ++-- recipes/demo/tests_demo/runner_demo.py | 2 +- recipes/nextcloud/tests_nextcloud/conftest.py | 4 ++-- .../nextcloud/tests_nextcloud/runner_nextcloud.py | 2 +- recipes/nextcloud/tests_nextcloud/setup_nextcloud.py | 4 ++-- recipes/wordpress/tests_wordpress/conftest.py | 2 +- .../wordpress/tests_wordpress/runner_wordpress.py | 2 +- recipes/wordpress/tests_wordpress/setup_wordpress.py | 2 +- .../tests_wordpress/test_wordpress_localization.py | 2 +- tests/test_env_resolution.py | 4 ++-- tests/test_url.py | 2 +- 26 files changed, 43 insertions(+), 43 deletions(-) rename {src => abratest}/__init__.py (100%) rename {src => abratest}/coordinator.py (92%) rename {src => abratest}/dir_manager.py (100%) rename {src => abratest}/env_manager.py (96%) rename {src => abratest}/html_helper.py (100%) rename {src => abratest}/plugin-abra.py (97%) rename {src => abratest}/runner.py (98%) rename {src => abratest}/runner_dict.py (54%) rename {src => abratest}/runner_manager.py (91%) rename {src => abratest}/utils.py (100%) diff --git a/src/__init__.py b/abratest/__init__.py similarity index 100% rename from src/__init__.py rename to abratest/__init__.py diff --git a/src/coordinator.py b/abratest/coordinator.py similarity index 92% rename from src/coordinator.py rename to abratest/coordinator.py index 6f7d11c..69593ec 100644 --- a/src/coordinator.py +++ b/abratest/coordinator.py @@ -2,12 +2,12 @@ from pathlib import Path from loguru import logger -from src.dir_manager import DirManager -from src.env_manager import EnvFile, EnvManager -from src.html_helper import merge_html_files -from src.runner import Runner -from src.runner_dict import RUNNER_DICT -from src.utils import rmtree +from abratest.dir_manager import DirManager +from abratest.env_manager import EnvFile, EnvManager +from abratest.html_helper import merge_html_files +from abratest.runner import Runner +from abratest.runner_dict import RUNNER_DICT +from abratest.utils import rmtree class Coordinator: diff --git a/src/dir_manager.py b/abratest/dir_manager.py similarity index 100% rename from src/dir_manager.py rename to abratest/dir_manager.py diff --git a/src/env_manager.py b/abratest/env_manager.py similarity index 96% rename from src/env_manager.py rename to abratest/env_manager.py index d53f742..9eb2232 100644 --- a/src/env_manager.py +++ b/abratest/env_manager.py @@ -4,9 +4,9 @@ from typing import NamedTuple from dotenv import dotenv_values -from src.dir_manager import DirManager -from src.runner_dict import RUNNER_DICT -from src.runner_manager import RunnerManager +from abratest.dir_manager import DirManager +from abratest.runner_dict import RUNNER_DICT +from abratest.runner_manager import RunnerManager class EnvFile(NamedTuple): diff --git a/src/html_helper.py b/abratest/html_helper.py similarity index 100% rename from src/html_helper.py rename to abratest/html_helper.py diff --git a/src/plugin-abra.py b/abratest/plugin-abra.py similarity index 97% rename from src/plugin-abra.py rename to abratest/plugin-abra.py index d667399..62f5480 100644 --- a/src/plugin-abra.py +++ b/abratest/plugin-abra.py @@ -14,8 +14,8 @@ from dotenv import dotenv_values from playwright.sync_api import BrowserContext, expect from pytest import Parser -from src.dir_manager import DirManager -from src.utils import BaseUrl +from abratest.dir_manager import DirManager +from abratest.utils import BaseUrl # global timeout and LOCALE LOCALE = {"Accept-Language": "de_DE"} diff --git a/src/runner.py b/abratest/runner.py similarity index 98% rename from src/runner.py rename to abratest/runner.py index 1cccb1e..8ea95a4 100644 --- a/src/runner.py +++ b/abratest/runner.py @@ -6,7 +6,7 @@ import pytest from dotenv import dotenv_values from loguru import logger -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager @dataclass @@ -64,7 +64,7 @@ class Runner: # condition_met: true / false identifier_string = self.combine_names(self.name, test.test_file) - full_test_path = self.DIR.RECIPES / self.test_dir_name / test.test_file + full_test_path = self.DIR.RECIPES / self.name / self.test_dir_name / test.test_file # check if test aleady passed if self._is_test_passed(identifier_string, remove_existing=True): diff --git a/src/runner_dict.py b/abratest/runner_dict.py similarity index 54% rename from src/runner_dict.py rename to abratest/runner_dict.py index b6955e1..e4b694d 100644 --- a/src/runner_dict.py +++ b/abratest/runner_dict.py @@ -1,11 +1,11 @@ from typing import TYPE_CHECKING -from tests_authentik.runner_authentik import RunnerAuthentik -from tests_nextcloud.runner_nextcloud import RunnerNextcloud -from tests_wordpress.runner_wordpress import RunnerWordpress +from authentik.tests_authentik.runner_authentik import RunnerAuthentik +from nextcloud.tests_nextcloud.runner_nextcloud import RunnerNextcloud +from wordpress.tests_wordpress.runner_wordpress import RunnerWordpress if TYPE_CHECKING: - from src.runner import Runner + from abratest.runner import Runner # Register all runners here. Each .env file with TYPE=authentik will be run with RunnerAuthentik diff --git a/src/runner_manager.py b/abratest/runner_manager.py similarity index 91% rename from src/runner_manager.py rename to abratest/runner_manager.py index 25a890f..c6fd6b3 100644 --- a/src/runner_manager.py +++ b/abratest/runner_manager.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING from icecream import ic if TYPE_CHECKING: - from src.env_manager import EnvFile, EnvManager + from abratest.env_manager import EnvFile, EnvManager class RunnerManager: diff --git a/src/utils.py b/abratest/utils.py similarity index 100% rename from src/utils.py rename to abratest/utils.py diff --git a/main.py b/main.py index c1f3d0c..60321ef 100644 --- a/main.py +++ b/main.py @@ -4,9 +4,9 @@ from pathlib import Path from loguru import logger -from src.coordinator import Coordinator -from src.dir_manager import DirManager -from src.utils import get_session_id +from abratest.coordinator import Coordinator +from abratest.dir_manager import DirManager +from abratest.utils import get_session_id # ----------------------------- lookup env files ----------------------------- # @@ -31,7 +31,7 @@ ENV_FILES = [ OUTPUT_DIR = Path("./test-output").resolve() -RECIPES_DIR = Path("./src-tests").resolve() +RECIPES_DIR = Path("./recipes").resolve() # --------------------- load credentials to env variables -------------------- # @@ -49,7 +49,7 @@ for key, value in CREDENTIALS.items(): # add abra-testing dir -os.environ["PYTEST_PLUGINS"] = "src.plugin-abra" # "src.plugin,src.other" +os.environ["PYTEST_PLUGINS"] = "abratest.plugin-abra" # "abratest.plugin,abratest.other" # os.environ["PWDEBUG"] = "1" diff --git a/previous-work/wordpress_test.py b/previous-work/wordpress_test.py index 0e84a46..bf61351 100644 --- a/previous-work/wordpress_test.py +++ b/previous-work/wordpress_test.py @@ -1,6 +1,6 @@ from playwright.sync_api import BrowserContext, expect -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager def test_wordpress(admin_session: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager): diff --git a/recipes/authentik/tests_authentik/fixtures_authentik.py b/recipes/authentik/tests_authentik/fixtures_authentik.py index 6b24538..3f27b43 100644 --- a/recipes/authentik/tests_authentik/fixtures_authentik.py +++ b/recipes/authentik/tests_authentik/fixtures_authentik.py @@ -4,7 +4,7 @@ import pytest from dotenv import dotenv_values from playwright.sync_api import BrowserContext, Page -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager @pytest.fixture diff --git a/recipes/authentik/tests_authentik/runner_authentik.py b/recipes/authentik/tests_authentik/runner_authentik.py index 5b19788..a3bba32 100644 --- a/recipes/authentik/tests_authentik/runner_authentik.py +++ b/recipes/authentik/tests_authentik/runner_authentik.py @@ -1,4 +1,4 @@ -from src.runner import Runner, Test +from abratest.runner import Runner, Test def condition_always_true(dotenv_config: dict[str, str]) -> bool: diff --git a/recipes/authentik/tests_authentik/setup_authentik.py b/recipes/authentik/tests_authentik/setup_authentik.py index 65d1ac7..b7f7f37 100644 --- a/recipes/authentik/tests_authentik/setup_authentik.py +++ b/recipes/authentik/tests_authentik/setup_authentik.py @@ -4,8 +4,8 @@ import re from playwright.sync_api import BrowserContext, expect -from src.dir_manager import DirManager -from src.utils import BaseUrl +from abratest.dir_manager import DirManager +from abratest.utils import BaseUrl ADMIN_USER = os.environ["ADMIN_USER"] ADMIN_PASS = os.environ["ADMIN_PASS"] diff --git a/recipes/demo/tests_demo/fixtures_demo.py b/recipes/demo/tests_demo/fixtures_demo.py index f4a3919..b271e60 100644 --- a/recipes/demo/tests_demo/fixtures_demo.py +++ b/recipes/demo/tests_demo/fixtures_demo.py @@ -5,7 +5,7 @@ depend on [demo]. For this to work 1. the Runner class of the other test needs to define the depencency as seen by referencing RunnerDemo in the dependencies list: -from src.tests_demo.runner_demo import RunnerDemo +from abratest.tests_demo.runner_demo import RunnerDemo class RunnerOther(Runner): dependencies = [RunnerDemo] @@ -15,7 +15,7 @@ class RunnerOther(Runner): To globally import for all tests in 'other', the import should be done in conftest: in 'conftest.py' in 'test_other' dir: -from src.tests_demo.fixtures_demo import demo_fixture +from abratest.tests_demo.fixtures_demo import demo_fixture """ import pytest diff --git a/recipes/demo/tests_demo/runner_demo.py b/recipes/demo/tests_demo/runner_demo.py index 83ffe42..ab2618c 100644 --- a/recipes/demo/tests_demo/runner_demo.py +++ b/recipes/demo/tests_demo/runner_demo.py @@ -1,4 +1,4 @@ -from src.runner import Runner, Test +from abratest.runner import Runner, Test class RunnerDemo(Runner): diff --git a/recipes/nextcloud/tests_nextcloud/conftest.py b/recipes/nextcloud/tests_nextcloud/conftest.py index 7b8ca2d..88f5b09 100644 --- a/recipes/nextcloud/tests_nextcloud/conftest.py +++ b/recipes/nextcloud/tests_nextcloud/conftest.py @@ -4,8 +4,8 @@ import os import pytest from playwright.sync_api import BrowserContext, Page -from src.dir_manager import DirManager -from src.utils import BaseUrl +from abratest.dir_manager import DirManager +from abratest.utils import BaseUrl pytest_plugins = "tests_authentik.fixtures_authentik" diff --git a/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py b/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py index e3f4ed4..8ea7063 100644 --- a/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py +++ b/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py @@ -1,4 +1,4 @@ -from src.runner import Runner, Test +from abratest.runner import Runner, Test def condition_always_false(dotenv_config: dict[str, str]) -> bool: diff --git a/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py b/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py index 650f951..7c041dd 100644 --- a/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py +++ b/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py @@ -1,7 +1,7 @@ from playwright.sync_api import Page, expect -from src.dir_manager import DirManager -from src.utils import BaseUrl +from abratest.dir_manager import DirManager +from abratest.utils import BaseUrl # url dashboard # https://files.test.dev.local-it.cloud/apps/dashboard/ diff --git a/recipes/wordpress/tests_wordpress/conftest.py b/recipes/wordpress/tests_wordpress/conftest.py index c844cbf..db4e529 100644 --- a/recipes/wordpress/tests_wordpress/conftest.py +++ b/recipes/wordpress/tests_wordpress/conftest.py @@ -4,7 +4,7 @@ import pytest from dotenv import dotenv_values from playwright.sync_api import BrowserContext, Page -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager pytest_plugins = "tests_authentik.fixtures_authentik" diff --git a/recipes/wordpress/tests_wordpress/runner_wordpress.py b/recipes/wordpress/tests_wordpress/runner_wordpress.py index 9b9ffa1..7167ce8 100644 --- a/recipes/wordpress/tests_wordpress/runner_wordpress.py +++ b/recipes/wordpress/tests_wordpress/runner_wordpress.py @@ -1,4 +1,4 @@ -from src.runner import Runner, Test +from abratest.runner import Runner, Test def condition_always_true(dotenv_config: dict[str, str]) -> bool: diff --git a/recipes/wordpress/tests_wordpress/setup_wordpress.py b/recipes/wordpress/tests_wordpress/setup_wordpress.py index 0f3e602..0d8243a 100644 --- a/recipes/wordpress/tests_wordpress/setup_wordpress.py +++ b/recipes/wordpress/tests_wordpress/setup_wordpress.py @@ -1,7 +1,7 @@ import pytest from playwright.sync_api import BrowserContext, Page, expect -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager def test_visit_from_domain(authentik_admin_context: BrowserContext, dotenv_config: dict[str, str]): diff --git a/recipes/wordpress/tests_wordpress/test_wordpress_localization.py b/recipes/wordpress/tests_wordpress/test_wordpress_localization.py index 8c9ffa4..1583a9f 100644 --- a/recipes/wordpress/tests_wordpress/test_wordpress_localization.py +++ b/recipes/wordpress/tests_wordpress/test_wordpress_localization.py @@ -2,7 +2,7 @@ from playwright.sync_api import BrowserContext, expect -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager def test_welcome_message(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager): diff --git a/tests/test_env_resolution.py b/tests/test_env_resolution.py index 2c1bc97..b6ba802 100644 --- a/tests/test_env_resolution.py +++ b/tests/test_env_resolution.py @@ -2,8 +2,8 @@ from pathlib import Path import pytest -# from src.env_file_helper import DependencyRule, EnvFile, sort_env_files_by_rule -from src.env_manager import DependencyRule, EnvFile, EnvManager +# from abratest.env_file_helper import DependencyRule, EnvFile, sort_env_files_by_rule +from abratest.env_manager import DependencyRule, EnvFile, EnvManager def test_complex_sorting() -> None: diff --git a/tests/test_url.py b/tests/test_url.py index 796c6f0..680023f 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -1,4 +1,4 @@ -from src.utils import BaseUrl +from abratest.utils import BaseUrl url_input = { "netloc": "blog.dev.local-it.cloud",