100100"""
101101
102102
103+ @pytest .fixture (autouse = True )
104+ def default_files (monkeypatch ):
105+ """Overrides mocked default files from conftest.py as we have our own mocks here."""
106+ monkeypatch .setattr (gitlab .config , "_DEFAULT_FILES" , config ._DEFAULT_FILES )
107+
108+
103109def global_retry_transient_errors (value : bool ) -> str :
104110 return f"""[global]
105111default = one
@@ -129,24 +135,19 @@ def _mock_existent_file(path, *args, **kwargs):
129135 return path
130136
131137
132- @pytest .fixture
133- def mock_clean_env (monkeypatch ):
134- monkeypatch .delenv ("PYTHON_GITLAB_CFG" , raising = False )
135-
136-
137138def test_env_config_missing_file_raises (monkeypatch ):
138139 monkeypatch .setenv ("PYTHON_GITLAB_CFG" , "/some/path" )
139140 with pytest .raises (config .GitlabConfigMissingError ):
140141 config ._get_config_files ()
141142
142143
143- def test_env_config_not_defined_does_not_raise (mock_clean_env , monkeypatch ):
144+ def test_env_config_not_defined_does_not_raise (monkeypatch ):
144145 with monkeypatch .context () as m :
145146 m .setattr (config , "_DEFAULT_FILES" , [])
146147 assert config ._get_config_files () == []
147148
148149
149- def test_default_config (mock_clean_env , monkeypatch ):
150+ def test_default_config (monkeypatch ):
150151 with monkeypatch .context () as m :
151152 m .setattr (Path , "resolve" , _mock_nonexistent_file )
152153 cp = config .GitlabConfigParser ()
@@ -169,7 +170,7 @@ def test_default_config(mock_clean_env, monkeypatch):
169170
170171
171172@mock .patch ("builtins.open" )
172- def test_invalid_id (m_open , mock_clean_env , monkeypatch ):
173+ def test_invalid_id (m_open , monkeypatch ):
173174 fd = io .StringIO (no_default_config )
174175 fd .close = mock .Mock (return_value = None )
175176 m_open .return_value = fd
0 commit comments