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

Commit0b7933c

Browse files
chore: correct ModuleNotFoundError() arguments
Previously in commit233b79e I hadused the `name` argument for `ModuleNotFoundError()`. This basicallyis the equivalent of not passing any message to`ModuleNotFoundError()`. So when the exception was raised it wasn'tvery helpful.Correct that and add a unit-test that shows we get the message weexpect.
1 parentf0152dc commit0b7933c

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
ifconfig.api_versionnotin ("4",):# dead code # pragma: no cover
304-
raiseModuleNotFoundError(name=f"gitlab.v{config.api_version}.cli")
304+
raiseModuleNotFoundError(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
ifself._api_versionnotin ("4",):
119-
raiseModuleNotFoundError(name=f"gitlab.v{self._api_version}.objects")
119+
raiseModuleNotFoundError(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
importgitlab.v4.objects
@@ -209,7 +209,7 @@ def __setstate__(self, state: Dict[str, Any]) -> None:
209209
# We only support v4 API at this time
210210
ifself._api_versionnotin ("4",):
211211
raiseModuleNotFoundError(
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
deftest_gitlab_init_with_invalid_api_version():
94-
withpytest.raises(ModuleNotFoundError):
94+
withpytest.raises(ModuleNotFoundError,match="gitlab.v1.objects"):
9595
gitlab.Gitlab(api_version="1")
9696

9797

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp