Skip to content
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

Merged
merged 2 commits into from
May 10, 2023
Merged

ci: Switch flake8 and isort for ruff #329

merged 2 commits into from
May 10, 2023

Conversation

marksweb
Copy link
Member

@marksweb marksweb commented May 5, 2023

This switches our linting from flake8 and isort to ruff.

@@ -83,6 +82,7 @@ def register_versionadmin_proxy(versionable, admin_site=None):
versionable.version_model_proxy
),
UserWarning,
stacklevel=2
Copy link
Member Author

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

Copy link
Member

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:

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
Copy link

codecov bot commented May 10, 2023

Codecov Report

Merging #329 (09df193) into master (0d006ce) will not change coverage.
The diff coverage is 83.13%.

@@           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           
Impacted Files Coverage Δ
djangocms_versioning/compat.py 100.00% <ø> (ø)
djangocms_versioning/conf.py 100.00% <ø> (ø)
..._versioning/management/commands/create_versions.py 95.55% <0.00%> (ø)
djangocms_versioning/operations.py 100.00% <ø> (ø)
djangocms_versioning/signals.py 100.00% <ø> (ø)
...ms_versioning/templatetags/djangocms_versioning.py 100.00% <ø> (ø)
...st_utils/incorrectly_configured_blogpost/models.py 80.00% <0.00%> (ø)
djangocms_versioning/test_utils/people/models.py 76.92% <0.00%> (ø)
...ioning/test_utils/polls/templatetags/polls_tags.py 66.66% <ø> (ø)
...ioning/test_utils/unversioned_editable_app/urls.py 0.00% <ø> (ø)
... and 19 more

@marksweb marksweb merged commit 3e6e587 into master May 10, 2023
@marksweb marksweb deleted the feat/ruff branch May 10, 2023 21:37
@fsbraun fsbraun mentioned this pull request Nov 16, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants