Skip to content

Commit c8256a5

Browse files
chore: fix functional test failure if config present
Fix functional test failure if config present and configured with token. Closes: python-gitlab#1791
1 parent a3eafab commit c8256a5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/functional/cli/test_cli.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44
import responses
55

6-
from gitlab import __version__
6+
from gitlab import __version__, config
77

88

99
@pytest.fixture
@@ -30,9 +30,13 @@ def test_version(script_runner):
3030

3131

3232
@pytest.mark.script_launch_mode("inprocess")
33-
def test_defaults_to_gitlab_com(script_runner, resp_get_project):
34-
# Runs in-process to intercept requests to gitlab.com
35-
ret = script_runner.run("gitlab", "project", "get", "--id", "1")
33+
def test_defaults_to_gitlab_com(script_runner, resp_get_project, monkeypatch):
34+
with monkeypatch.context() as m:
35+
# Ensure we don't pick up any config files that may already exist in the local
36+
# environment.
37+
m.setattr(config, "_DEFAULT_FILES", [])
38+
# Runs in-process to intercept requests to gitlab.com
39+
ret = script_runner.run("gitlab", "project", "get", "--id", "1")
3640
assert ret.success
3741
assert "id: 1" in ret.stdout
3842

0 commit comments

Comments
 (0)