Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix a check_framework test so it doesn't fail when TEST_RUNNER is set…

… (e.g. on CI).
  • Loading branch information...
commit fb862c875eae6b61bd1939bf071ba48890524679 1 parent 6070a5d
Carl Meyer carljm authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 tests/check_framework/tests.py
10 tests/check_framework/tests.py
View
@@ -94,9 +94,12 @@ def test_test_runner_overriden(self):
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 @@ def test_test_runner_not_set_explicitly(self):
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')
Please sign in to comment.
Something went wrong with that request. Please try again.