diff options
| author | Carl Meyer <carl@oddbird.net> | 2014-01-20 21:08:02 -0700 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2014-01-20 21:08:02 -0700 |
| commit | fb862c875eae6b61bd1939bf071ba48890524679 (patch) | |
| tree | 80045282c5f96b03ef3eb5efc0f2bf72f4c252c3 /tests/check_framework/tests.py | |
| parent | 6070a5d6a6950bdbd93853c4b1636c7eec820b20 (diff) | |
Fix a check_framework test so it doesn't fail when TEST_RUNNER is set (e.g. on CI).
Diffstat (limited to 'tests/check_framework/tests.py')
| -rw-r--r-- | tests/check_framework/tests.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/check_framework/tests.py b/tests/check_framework/tests.py index 5ad57d0659..30e321b28b 100644 --- a/tests/check_framework/tests.py +++ b/tests/check_framework/tests.py @@ -94,9 +94,12 @@ class Django_1_6_0_CompatibilityChecks(TestCase): self.assertEqual(errors, []) def test_test_runner_not_set_explicitly(self): + # If TEST_RUNNER was set explicitly, temporarily pretend it wasn't + test_runner_overridden = False + if 'TEST_RUNNER' in settings._wrapped._explicit_settings: + test_runner_overridden = True + settings._wrapped._explicit_settings.remove('TEST_RUNNER') # We remove some settings to make this look like a project generated under Django 1.5. - old_test_runner = settings._wrapped.TEST_RUNNER - del settings._wrapped.TEST_RUNNER settings._wrapped._explicit_settings.add('MANAGERS') settings._wrapped._explicit_settings.add('ADMINS') try: @@ -116,7 +119,8 @@ class Django_1_6_0_CompatibilityChecks(TestCase): self.assertEqual(errors, expected) finally: # Restore settings value - settings._wrapped.TEST_RUNNER = old_test_runner + if test_runner_overridden: + settings._wrapped._explicit_settings.add('TEST_RUNNER') settings._wrapped._explicit_settings.remove('MANAGERS') settings._wrapped._explicit_settings.remove('ADMINS') |
