Skip to content

Commit

Permalink
Fix a check_framework test so it doesn't fail when TEST_RUNNER is set…
Browse files Browse the repository at this point in the history
… (e.g. on CI).
  • Loading branch information
carljm committed Jan 21, 2014
1 parent 6070a5d commit fb862c8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/check_framework/tests.py
Expand Up @@ -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:
Expand All @@ -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')

Expand Down

0 comments on commit fb862c8

Please sign in to comment.