Ticket #17011: override_settings_max_recursion_error.diff

File override_settings_max_recursion_error.diff, 1.5 KB (added by jsdalton, 4 years ago)
  • tests/regressiontests/test_utils/tests.py

    diff --git a/tests/regressiontests/test_utils/tests.py b/tests/regressiontests/test_utils/tests.py
    index 942aa85..9eef1ef 100644
    a b from __future__ import with_statement 
    33from django.forms import EmailField
    44from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
    55from django.utils.unittest import skip
     6from django.test.utils import override_settings
    67
    78from models import Person
    89
    class AssertFieldOutputTests(SimpleTestCase): 
    150151        self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'a@a.com'}, {'aaa': [u'Come on, gimme some well formatted data, dude.']})
    151152
    152153
     154class OverrideSettingsTestsSuper(TestCase):
     155    """
     156    Dummy class for testing max recursion error in child class call to super()
     157    """
     158    def test_max_recursion_error(self):
     159        pass
     160
     161
     162@override_settings(FOO='bar')
     163class OverrideSettingsTests(OverrideSettingsTestsSuper):
     164    def test_max_recursion_error(self):
     165        """
     166        Overriding a method on a super class and then calling that method on
     167        the super class triggers infinite recursion
     168        """
     169        try:
     170            super(OverrideSettingsTests, self).test_max_recursion_error()
     171        except RuntimeError, e:
     172            self.fail()
     173
     174
    153175__test__ = {"API_TEST": r"""
    154176# Some checks of the doctest output normalizer.
    155177# Standard doctests do fairly
Back to Top