10
10
import gitlab
11
11
12
12
13
- TEMP_DIR = tempfile .gettempdir ()
14
- TEST_DIR = Path (__file__ ).resolve ().parent
15
-
16
-
17
13
def reset_gitlab (gl ):
18
14
# previously tools/reset_gitlab.py
19
15
for project in gl .projects .list ():
@@ -27,8 +23,8 @@ def reset_gitlab(gl):
27
23
user .delete ()
28
24
29
25
30
- def set_token (container ):
31
- set_token_rb = TEST_DIR / "fixtures" / "set_token.rb"
26
+ def set_token (container , rootdir ):
27
+ set_token_rb = rootdir / "fixtures" / "set_token.rb"
32
28
33
29
with open (set_token_rb , "r" ) as f :
34
30
set_token_command = f .read ().strip ()
@@ -47,8 +43,18 @@ def set_token(container):
47
43
48
44
49
45
@pytest .fixture (scope = "session" )
50
- def docker_compose_file ():
51
- return TEST_DIR / "fixtures" / "docker-compose.yml"
46
+ def temp_dir ():
47
+ return Path (tempfile .gettempdir ())
48
+
49
+
50
+ @pytest .fixture (scope = "session" )
51
+ def test_dir (pytestconfig ):
52
+ return pytestconfig .rootdir / "tools" / "functional"
53
+
54
+
55
+ @pytest .fixture (scope = "session" )
56
+ def docker_compose_file (test_dir ):
57
+ return test_dir / "fixtures" / "docker-compose.yml"
52
58
53
59
54
60
@pytest .fixture (scope = "session" )
@@ -78,15 +84,15 @@ def _check(container):
78
84
79
85
80
86
@pytest .fixture (scope = "session" )
81
- def gitlab_config (check_is_alive , docker_ip , docker_services ):
82
- config_file = Path ( TEMP_DIR ) / "python-gitlab.cfg"
87
+ def gitlab_config (check_is_alive , docker_ip , docker_services , temp_dir , test_dir ):
88
+ config_file = temp_dir / "python-gitlab.cfg"
83
89
port = docker_services .port_for ("gitlab" , 80 )
84
90
85
91
docker_services .wait_until_responsive (
86
92
timeout = 180 , pause = 5 , check = lambda : check_is_alive ("gitlab-test" )
87
93
)
88
94
89
- token = set_token ("gitlab-test" )
95
+ token = set_token ("gitlab-test" , rootdir = test_dir )
90
96
91
97
config = f"""[global]
92
98
default = local
0 commit comments