File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,11 @@ def __init__(
128
128
if self ._files :
129
129
self ._parse_config ()
130
130
131
+ if self .gitlab_id and not self ._files :
132
+ raise GitlabConfigMissingError (
133
+ f"A gitlab id was provided ({ self .gitlab_id } ) but no config file found"
134
+ )
135
+
131
136
def _parse_config (self ) -> None :
132
137
_config = configparser .ConfigParser ()
133
138
_config .read (self ._files )
Original file line number Diff line number Diff line change 25
25
import responses
26
26
27
27
import gitlab
28
+ from gitlab .config import GitlabConfigMissingError
28
29
from tests .unit import helpers
29
30
30
31
localhost = "http://localhost"
@@ -299,6 +300,11 @@ def test_gitlab_from_config(default_config):
299
300
gitlab .Gitlab .from_config ("one" , [config_path ])
300
301
301
302
303
+ def test_gitlab_from_config_without_files_raises ():
304
+ with pytest .raises (GitlabConfigMissingError , match = "non-existing" ):
305
+ gitlab .Gitlab .from_config ("non-existing" )
306
+
307
+
302
308
def test_gitlab_subclass_from_config (default_config ):
303
309
class MyGitlab (gitlab .Gitlab ):
304
310
pass
You can’t perform that action at this time.
0 commit comments