-
Notifications
You must be signed in to change notification settings - Fork 30
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
ci: Switch flake8 and isort for ruff #329
Conversation
@@ -83,6 +82,7 @@ def register_versionadmin_proxy(versionable, admin_site=None): | |||
versionable.version_model_proxy | |||
), | |||
UserWarning, | |||
stacklevel=2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fsbraun I don't know too much about this stacklevel
attribute, but this is the only change that I can see here that's anywhere near the test failure.
And the test failing runs this function to try to register a versionable model with admin (I think that's the idea here at least). That test code is here;
https://github.com/django-cms/djangocms-versioning/blob/master/tests/test_admin.py#L334
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marksweb I've also added ruff to #326.
And right, I remember now: When I added stacklevel=2
(I think CodeQL complained) the test_admin.py
stated failing. I changed the test which checks if this warning is issued, including comparing the stack level parameter.
See changed test here:
djangocms-versioning/tests/test_admin.py
Lines 357 to 360 in eaf5e9d
with patch.object(warnings, "warn") as mock: | |
register_versionadmin_proxy(versionable, site) | |
message = f"{Version!r} is already registered with admin." | |
mock.assert_called_with(message, UserWarning, stacklevel=2) |
Codecov Report
@@ Coverage Diff @@
## master #329 +/- ##
=======================================
Coverage 90.53% 90.53%
=======================================
Files 68 68
Lines 2324 2324
Branches 314 314
=======================================
Hits 2104 2104
Misses 165 165
Partials 55 55
|
This switches our linting from flake8 and isort to ruff.