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__(
128128 if self ._files :
129129 self ._parse_config ()
130130
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+
131136 def _parse_config (self ) -> None :
132137 _config = configparser .ConfigParser ()
133138 _config .read (self ._files )
Original file line number Diff line number Diff line change 2525import responses
2626
2727import gitlab
28+ from gitlab .config import GitlabConfigMissingError
2829from tests .unit import helpers
2930
3031localhost = "http://localhost"
@@ -299,6 +300,11 @@ def test_gitlab_from_config(default_config):
299300 gitlab .Gitlab .from_config ("one" , [config_path ])
300301
301302
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+
302308def test_gitlab_subclass_from_config (default_config ):
303309 class MyGitlab (gitlab .Gitlab ):
304310 pass
You can’t perform that action at this time.
0 commit comments