Skip to content

Commit

Permalink
Merge pull request #2173 from python-gitlab/jlvillal/config_test_fix
Browse files Browse the repository at this point in the history
test: fix broken test if user had config files
  • Loading branch information
nejch committed Jul 23, 2022
2 parents 7afd340 + 864fc12 commit 1ecbc7c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/unit/test_gitlab.py
Expand Up @@ -20,6 +20,7 @@
import logging
import pickle
from http.client import HTTPConnection
from typing import List, Optional, Union

import pytest
import responses
Expand Down Expand Up @@ -300,7 +301,11 @@ def test_gitlab_from_config(default_config):
gitlab.Gitlab.from_config("one", [config_path])


def test_gitlab_from_config_without_files_raises():
def test_gitlab_from_config_without_files_raises(monkeypatch):
def no_files(config_files: Optional[List[str]] = None) -> Union[str, List[str]]:
return []

monkeypatch.setattr(gitlab.config, "_get_config_files", no_files)
with pytest.raises(GitlabConfigMissingError, match="non-existing"):
gitlab.Gitlab.from_config("non-existing")

Expand Down

0 comments on commit 1ecbc7c

Please sign in to comment.