@@ -236,15 +236,13 @@ def _wait(timeout: int = 30, step: float = 0.5, allow_fail: bool = False) -> boo
236236
237237
238238@pytest .fixture (scope = "session" )
239- def gitlab_config (
239+ def gitlab_token (
240240check_is_alive ,
241241gitlab_container_name :str ,
242242gitlab_url :str ,
243243docker_services ,
244- temp_dir :pathlib .Path ,
245244fixture_dir :pathlib .Path ,
246- ):
247- config_file = temp_dir / "python-gitlab.cfg"
245+ )-> str :
248246
249247start_time = time .perf_counter ()
250248logging .info ("Waiting for GitLab container to become ready." )
@@ -263,15 +261,20 @@ def gitlab_config(
263261f"GitLab container is now ready after{ minutes } minute(s),{ seconds } seconds"
264262 )
265263
266- token = set_token (gitlab_container_name ,fixture_dir = fixture_dir )
264+ return set_token (gitlab_container_name ,fixture_dir = fixture_dir )
265+
266+
267+ @pytest .fixture (scope = "session" )
268+ def gitlab_config (gitlab_url :str ,gitlab_token :str ,temp_dir :pathlib .Path ):
269+ config_file = temp_dir / "python-gitlab.cfg"
267270
268271config = f"""[global]
269272default = local
270273timeout = 60
271274
272275[local]
273276url ={ gitlab_url }
274- private_token ={ token }
277+ private_token ={ gitlab_token }
275278api_version = 4"""
276279
277280with open (config_file ,"w" ,encoding = "utf-8" )as f :
@@ -281,11 +284,11 @@ def gitlab_config(
281284
282285
283286@pytest .fixture (scope = "session" )
284- def gl (gitlab_config ) :
287+ def gl (gitlab_url : str , gitlab_token : str ) -> gitlab . Gitlab :
285288"""Helper instance to make fixtures and asserts directly via the API."""
286289
287290logging .info ("Instantiating python-gitlab gitlab.Gitlab instance" )
288- instance = gitlab .Gitlab . from_config ( "local" , [ gitlab_config ] )
291+ instance = gitlab .Gitlab ( gitlab_url , private_token = gitlab_token )
289292
290293logging .info ("Reset GitLab" )
291294reset_gitlab (instance )