-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
Fix override_config test decorator on Django 5.2 #609
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #609 +/- ##
==========================================
+ Coverage 84.23% 84.82% +0.58%
==========================================
Files 21 21
Lines 736 751 +15
Branches 117 122 +5
==========================================
+ Hits 620 637 +17
+ Misses 83 82 -1
+ Partials 33 32 -1 ☔ View full report in Codecov by Sentry. |
original_pre_setup(inner_self) | ||
else: | ||
|
||
@classmethod |
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.
Can we create a decorator for that so that we don't have to duplicate the code of the method?
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.
The decorator is not the only difference, the call to original_pre_setup also differs (as we don't have to pass the instance anymore)
Additionally, this version is probably easier to clean up when Django5.2 will be the minimum supported version
Yet another Django 5.2 fix:
Django 5.2 is the first version to ship this PR turning
pre_setup
into a classmethod and generating this error (already visible in tox, but ignored)I found this fix, following the current solution but maybe a better (and more modern) solution exists
"""
Override the config by modifying TestCase methods.
This method follows the Django <= 1.6 method of overriding the
_pre_setup and _post_teardown hooks rather than modifying the TestCase
itself.
"""