Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitac46c1c

Browse files
nejchJohnVillalovos
authored andcommitted
fix(config): raise error when gitlab id provided but no config file found
1 parent789ef81 commitac46c1c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

‎gitlab/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ def __init__(
128128
ifself._files:
129129
self._parse_config()
130130

131+
ifself.gitlab_idandnotself._files:
132+
raiseGitlabConfigMissingError(
133+
f"A gitlab id was provided ({self.gitlab_id}) but no config file found"
134+
)
135+
131136
def_parse_config(self)->None:
132137
_config=configparser.ConfigParser()
133138
_config.read(self._files)

‎tests/unit/test_gitlab.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
importresponses
2626

2727
importgitlab
28+
fromgitlab.configimportGitlabConfigMissingError
2829
fromtests.unitimporthelpers
2930

3031
localhost="http://localhost"
@@ -299,6 +300,11 @@ def test_gitlab_from_config(default_config):
299300
gitlab.Gitlab.from_config("one", [config_path])
300301

301302

303+
deftest_gitlab_from_config_without_files_raises():
304+
withpytest.raises(GitlabConfigMissingError,match="non-existing"):
305+
gitlab.Gitlab.from_config("non-existing")
306+
307+
302308
deftest_gitlab_subclass_from_config(default_config):
303309
classMyGitlab(gitlab.Gitlab):
304310
pass

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp