Skip to content

Commit b2e6f3b

Browse files
authored
Merge pull request #2033 from python-gitlab/jlvillal/module_not_found_error
chore: correct ModuleNotFoundError() arguments
2 parents 38218e5 + 0b7933c commit b2e6f3b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

gitlab/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def main() -> None:
301301
sys.exit(e)
302302
# We only support v4 API at this time
303303
if config.api_version not in ("4",): # dead code # pragma: no cover
304-
raise ModuleNotFoundError(name=f"gitlab.v{config.api_version}.cli")
304+
raise ModuleNotFoundError(f"gitlab.v{config.api_version}.cli")
305305

306306
# Now we build the entire set of subcommands and do the complete parsing
307307
parser = _get_parser()

gitlab/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def __init__(
116116

117117
# We only support v4 API at this time
118118
if self._api_version not in ("4",):
119-
raise ModuleNotFoundError(name=f"gitlab.v{self._api_version}.objects")
119+
raise ModuleNotFoundError(f"gitlab.v{self._api_version}.objects")
120120
# NOTE: We must delay import of gitlab.v4.objects until now or
121121
# otherwise it will cause circular import errors
122122
import gitlab.v4.objects
@@ -209,7 +209,7 @@ def __setstate__(self, state: Dict[str, Any]) -> None:
209209
# We only support v4 API at this time
210210
if self._api_version not in ("4",):
211211
raise ModuleNotFoundError(
212-
name=f"gitlab.v{self._api_version}.objects"
212+
f"gitlab.v{self._api_version}.objects"
213213
) # pragma: no cover, dead code currently
214214
# NOTE: We must delay import of gitlab.v4.objects until now or
215215
# otherwise it will cause circular import errors

tests/unit/test_gitlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_gitlab_init_with_valid_api_version():
9191

9292

9393
def test_gitlab_init_with_invalid_api_version():
94-
with pytest.raises(ModuleNotFoundError):
94+
with pytest.raises(ModuleNotFoundError, match="gitlab.v1.objects"):
9595
gitlab.Gitlab(api_version="1")
9696

9797

0 commit comments

Comments
 (0)