summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-05-30 08:38:03 +0200
committerGitHub <noreply@github.com>2022-05-30 08:38:03 +0200
commitb2e6f3bc0dd6d8a7da39939850689a3677eb2444 (patch)
treee5df7a42bb7db68c9a8d02f5b4653e6fb2c82b5f
parent38218e5d099f112ed0e1784282e5edc4956fee15 (diff)
parent0b7933c5632c2f81c89f9a97e814badf65d1eb38 (diff)
downloadgitlab-b2e6f3bc0dd6d8a7da39939850689a3677eb2444.tar.gz
Merge pull request #2033 from python-gitlab/jlvillal/module_not_found_error
chore: correct ModuleNotFoundError() arguments
-rw-r--r--gitlab/cli.py2
-rw-r--r--gitlab/client.py4
-rw-r--r--tests/unit/test_gitlab.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/gitlab/cli.py b/gitlab/cli.py
index cad6b6f..4159632 100644
--- a/gitlab/cli.py
+++ b/gitlab/cli.py
@@ -301,7 +301,7 @@ def main() -> None:
sys.exit(e)
# We only support v4 API at this time
if config.api_version not in ("4",): # dead code # pragma: no cover
- raise ModuleNotFoundError(name=f"gitlab.v{config.api_version}.cli")
+ raise ModuleNotFoundError(f"gitlab.v{config.api_version}.cli")
# Now we build the entire set of subcommands and do the complete parsing
parser = _get_parser()
diff --git a/gitlab/client.py b/gitlab/client.py
index bba5c1d..a9bd48f 100644
--- a/gitlab/client.py
+++ b/gitlab/client.py
@@ -116,7 +116,7 @@ class Gitlab:
# We only support v4 API at this time
if self._api_version not in ("4",):
- raise ModuleNotFoundError(name=f"gitlab.v{self._api_version}.objects")
+ raise ModuleNotFoundError(f"gitlab.v{self._api_version}.objects")
# NOTE: We must delay import of gitlab.v4.objects until now or
# otherwise it will cause circular import errors
import gitlab.v4.objects
@@ -209,7 +209,7 @@ class Gitlab:
# We only support v4 API at this time
if self._api_version not in ("4",):
raise ModuleNotFoundError(
- name=f"gitlab.v{self._api_version}.objects"
+ f"gitlab.v{self._api_version}.objects"
) # pragma: no cover, dead code currently
# NOTE: We must delay import of gitlab.v4.objects until now or
# otherwise it will cause circular import errors
diff --git a/tests/unit/test_gitlab.py b/tests/unit/test_gitlab.py
index 070f215..13fc2d8 100644
--- a/tests/unit/test_gitlab.py
+++ b/tests/unit/test_gitlab.py
@@ -91,7 +91,7 @@ def test_gitlab_init_with_valid_api_version():
def test_gitlab_init_with_invalid_api_version():
- with pytest.raises(ModuleNotFoundError):
+ with pytest.raises(ModuleNotFoundError, match="gitlab.v1.objects"):
gitlab.Gitlab(api_version="1")