diff options
-rw-r--r-- | tools/functional/conftest.py | 28 | ||||
-rw-r--r-- | tools/functional/python_test_v4.py | 2 |
2 files changed, 18 insertions, 12 deletions
diff --git a/tools/functional/conftest.py b/tools/functional/conftest.py index 07cdc6b..9b80d20 100644 --- a/tools/functional/conftest.py +++ b/tools/functional/conftest.py @@ -10,10 +10,6 @@ import pytest import gitlab -TEMP_DIR = tempfile.gettempdir() -TEST_DIR = Path(__file__).resolve().parent - - def reset_gitlab(gl): # previously tools/reset_gitlab.py for project in gl.projects.list(): @@ -27,8 +23,8 @@ def reset_gitlab(gl): user.delete() -def set_token(container): - set_token_rb = TEST_DIR / "fixtures" / "set_token.rb" +def set_token(container, rootdir): + set_token_rb = rootdir / "fixtures" / "set_token.rb" with open(set_token_rb, "r") as f: set_token_command = f.read().strip() @@ -47,8 +43,18 @@ def set_token(container): @pytest.fixture(scope="session") -def docker_compose_file(): - return TEST_DIR / "fixtures" / "docker-compose.yml" +def temp_dir(): + return Path(tempfile.gettempdir()) + + +@pytest.fixture(scope="session") +def test_dir(pytestconfig): + return pytestconfig.rootdir / "tools" / "functional" + + +@pytest.fixture(scope="session") +def docker_compose_file(test_dir): + return test_dir / "fixtures" / "docker-compose.yml" @pytest.fixture(scope="session") @@ -78,15 +84,15 @@ def check_is_alive(request): @pytest.fixture(scope="session") -def gitlab_config(check_is_alive, docker_ip, docker_services): - config_file = Path(TEMP_DIR) / "python-gitlab.cfg" +def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir, test_dir): + config_file = temp_dir / "python-gitlab.cfg" port = docker_services.port_for("gitlab", 80) docker_services.wait_until_responsive( timeout=180, pause=5, check=lambda: check_is_alive("gitlab-test") ) - token = set_token("gitlab-test") + token = set_token("gitlab-test", rootdir=test_dir) config = f"""[global] default = local diff --git a/tools/functional/python_test_v4.py b/tools/functional/python_test_v4.py index 6c90fe6..b29f9f3 100644 --- a/tools/functional/python_test_v4.py +++ b/tools/functional/python_test_v4.py @@ -57,7 +57,7 @@ nxs4TLO3kZjUTgWKdhpgRNF5hwaz51ZjpebaRf/ZqRuNyX4lIRolDxzOn/+O1o8L qG2ZdhHHmSK2LaQLFiSprUkikStNU9BqSQ== =5OGa -----END PGP PUBLIC KEY BLOCK-----""" -AVATAR_PATH = Path(__file__).resolve().parent / "fixtures" / "avatar.png" +AVATAR_PATH = Path(__file__).parent / "fixtures" / "avatar.png" TEMP_DIR = Path(tempfile.gettempdir()) # token authentication from config file |