1010import gitlab
1111
1212
13- TEMP_DIR = tempfile .gettempdir ()
14- TEST_DIR = Path (__file__ ).resolve ().parent
15-
16-
1713def reset_gitlab (gl ):
1814# previously tools/reset_gitlab.py
1915for project in gl .projects .list ():
@@ -27,8 +23,8 @@ def reset_gitlab(gl):
2723user .delete ()
2824
2925
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"
3228
3329with open (set_token_rb ,"r" )as f :
3430set_token_command = f .read ().strip ()
@@ -47,8 +43,18 @@ def set_token(container):
4743
4844
4945@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"
5258
5359
5460@pytest .fixture (scope = "session" )
@@ -78,15 +84,15 @@ def _check(container):
7884
7985
8086@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"
8389port = docker_services .port_for ("gitlab" ,80 )
8490
8591docker_services .wait_until_responsive (
8692timeout = 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
9197config = f"""[global]
9298default = local