Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit40ec2f5

Browse files
committed
chore: use helper fixtures for test directories
1 parent27109ca commit40ec2f5

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

‎tools/functional/conftest.py‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
importgitlab
1111

1212

13-
TEMP_DIR=tempfile.gettempdir()
14-
TEST_DIR=Path(__file__).resolve().parent
15-
16-
1713
defreset_gitlab(gl):
1814
# previously tools/reset_gitlab.py
1915
forprojectingl.projects.list():
@@ -27,8 +23,8 @@ def reset_gitlab(gl):
2723
user.delete()
2824

2925

30-
defset_token(container):
31-
set_token_rb=TEST_DIR/"fixtures"/"set_token.rb"
26+
defset_token(container,rootdir):
27+
set_token_rb=rootdir/"fixtures"/"set_token.rb"
3228

3329
withopen(set_token_rb,"r")asf:
3430
set_token_command=f.read().strip()
@@ -47,8 +43,18 @@ def set_token(container):
4743

4844

4945
@pytest.fixture(scope="session")
50-
defdocker_compose_file():
51-
returnTEST_DIR/"fixtures"/"docker-compose.yml"
46+
deftemp_dir():
47+
returnPath(tempfile.gettempdir())
48+
49+
50+
@pytest.fixture(scope="session")
51+
deftest_dir(pytestconfig):
52+
returnpytestconfig.rootdir/"tools"/"functional"
53+
54+
55+
@pytest.fixture(scope="session")
56+
defdocker_compose_file(test_dir):
57+
returntest_dir/"fixtures"/"docker-compose.yml"
5258

5359

5460
@pytest.fixture(scope="session")
@@ -78,15 +84,15 @@ def _check(container):
7884

7985

8086
@pytest.fixture(scope="session")
81-
defgitlab_config(check_is_alive,docker_ip,docker_services):
82-
config_file=Path(TEMP_DIR)/"python-gitlab.cfg"
87+
defgitlab_config(check_is_alive,docker_ip,docker_services,temp_dir,test_dir):
88+
config_file=temp_dir/"python-gitlab.cfg"
8389
port=docker_services.port_for("gitlab",80)
8490

8591
docker_services.wait_until_responsive(
8692
timeout=180,pause=5,check=lambda:check_is_alive("gitlab-test")
8793
)
8894

89-
token=set_token("gitlab-test")
95+
token=set_token("gitlab-test",rootdir=test_dir)
9096

9197
config=f"""[global]
9298
default = local

‎tools/functional/python_test_v4.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
qG2ZdhHHmSK2LaQLFiSprUkikStNU9BqSQ==
5858
=5OGa
5959
-----END PGP PUBLIC KEY BLOCK-----"""
60-
AVATAR_PATH=Path(__file__).resolve().parent/"fixtures"/"avatar.png"
60+
AVATAR_PATH=Path(__file__).parent/"fixtures"/"avatar.png"
6161
TEMP_DIR=Path(tempfile.gettempdir())
6262

6363
# token authentication from config file

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp