Recursion error in TestCase class decorated by override_settings when overriding method on parent class and calling parent method
|Reported by:||jsdalton||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
A bit hard to explain but a fairly straightforward bug. Basically, if you have a sub class of TestCase and then a sub class of that sub class that's decorated by @override_settings at the class level, and you override a method and then call the parent method, you get a recursion error.
Kind of easier to demonstrate in code:
from django.test import TestCase from django.test.utils import override_settings class FooTests(TestCase): def setUp(self): # do some stuff pass @override_settings(FOO='bar') class SubFooTests(TestCase): def setUp(self): # recursion error! super(SubFooTests, self).setUp()
I have a patch with a regression test that formally demonstrates this behavior but have not investigated it yet. It's possible it's related to #16224, but I don't really know.
Change History (8)
Changed 5 years ago by jsdalton
comment:1 Changed 5 years ago by jsdalton
- Cc jim.dalton@… added
- Has patch set
- Needs documentation unset
- Needs tests unset
- Patch needs improvement set