Skip to content

chore: correct ModuleNotFoundError() arguments #2033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gitlab/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions gitlab/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __init__(

# 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
Expand Down Expand Up @@ -209,7 +209,7 @@ def __setstate__(self, state: Dict[str, Any]) -> None:
# 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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down