#32939: Permit override_settings to work with test class mixins that don't
inherit
from unittest.TestCase
-------------------------------------+-------------------------------------
Reporter: Chris Jerdonek | Owner: Chris
Type: | Jerdonek
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Chris Jerdonek):
I realize now that the "non-lazy" check could be kept by modifying it to
be done only when the class inherits from `unittest.TestCase` (i.e. when
the class is a concrete test class):
{{{
--- a/django/test/utils.py
+++ b/django/test/utils.py
@@ -515,7 +515,7 @@ class override_settings(TestContextDecorator):
def decorate_class(self, cls):
from django.test import SimpleTestCase
- if not issubclass(cls, SimpleTestCase):
+ if issubclass(cls, TestCase) and not issubclass(cls,
SimpleTestCase):
raise ValueError(
"Only subclasses of Django SimpleTestCase can be
decorated "
"with override_settings")
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32939#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.cd99135158e149177a5d5e11755d69d2%40djangoproject.com.