Skip to content

Commit ce8f3e6

Browse files
committed
chore(testing): rename fixture_dir to docker_assets_dir
IMHO this makes it more clear what this is. Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
1 parent d01664b commit ce8f3e6

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

gitlab/testing/docker/docker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def docker_compose_project_name():
1717

1818

1919
@pytest.fixture(scope="session")
20-
def docker_compose_file(fixture_dir):
21-
return fixture_dir / "docker-compose.yml"
20+
def docker_compose_file(docker_assets_dir):
21+
return docker_assets_dir / "docker-compose.yml"
2222

2323

2424
pytest_docker.docker_compose_file = docker_compose_file

gitlab/testing/fixtures/gitlab.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ def gitlab_version(gl) -> GitlabVersion:
3838

3939

4040
@pytest.fixture(scope="session")
41-
def fixture_dir(pt_gitlab_dir: Path) -> Path:
42-
return pt_gitlab_dir / "docker"
41+
def docker_assets_dir() -> Path:
42+
import gitlab.testing
43+
44+
return Path(gitlab.testing.__file__).parent / "docker"
4345

4446

4547
@pytest.fixture(scope="session")
@@ -127,7 +129,7 @@ def reset_gitlab(gl: gitlab.Gitlab) -> None: # noqa C901
127129
time.sleep(2)
128130

129131

130-
def set_token(container: str, fixture_dir: Path, gitlab_url: str) -> str:
132+
def set_token(container: str, docker_assets_dir: Path, gitlab_url: str) -> str:
131133
logging.info("Trying to load saved token")
132134
gitlab_token_path = Path(".gitlab_token")
133135
if gitlab_token_path.exists():
@@ -141,7 +143,7 @@ def set_token(container: str, fixture_dir: Path, gitlab_url: str) -> str:
141143
return saved_token
142144

143145
logging.info("Creating API token.")
144-
set_token_rb = fixture_dir / "set_token.rb"
146+
set_token_rb = docker_assets_dir / "set_token.rb"
145147

146148
with Path(set_token_rb).open(encoding="utf-8") as f:
147149
set_token_command = f.read().strip()
@@ -229,7 +231,7 @@ def gitlab_token(
229231
gitlab_container_name: str,
230232
gitlab_url: str,
231233
docker_services,
232-
fixture_dir: Path,
234+
docker_assets_dir: Path,
233235
) -> str:
234236
start_time = time.perf_counter()
235237
logging.info("Waiting for GitLab container to become ready.")
@@ -249,7 +251,9 @@ def gitlab_token(
249251
)
250252

251253
return set_token(
252-
gitlab_container_name, fixture_dir=fixture_dir, gitlab_url=gitlab_url
254+
gitlab_container_name,
255+
docker_assets_dir=docker_assets_dir,
256+
gitlab_url=gitlab_url,
253257
)
254258

255259

gitlab/testing/fixtures/meta.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
from pathlib import Path
2-
31
import pytest
42

53
import gitlab
64

75

8-
@pytest.fixture(scope="session")
9-
def pt_gitlab_dir() -> Path:
10-
import gitlab.testing
11-
12-
return Path(gitlab.testing.__file__).parent
13-
14-
156
@pytest.fixture(autouse=True)
167
def mock_clean_config(monkeypatch: pytest.MonkeyPatch) -> None:
178
"""Ensures user-defined environment variables do not interfere with tests."""

0 commit comments

Comments
 (0)