diff options
Diffstat (limited to 'tests/staticfiles_tests/test_liveserver.py')
| -rw-r--r-- | tests/staticfiles_tests/test_liveserver.py | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/tests/staticfiles_tests/test_liveserver.py b/tests/staticfiles_tests/test_liveserver.py index 2c9d7b71db..1bbadb337b 100644 --- a/tests/staticfiles_tests/test_liveserver.py +++ b/tests/staticfiles_tests/test_liveserver.py @@ -44,35 +44,26 @@ class StaticLiveServerChecks(LiveServerBase): @classmethod def setUpClass(cls): - # Backup original environment variable - address_predefined = 'DJANGO_LIVE_TEST_SERVER_ADDRESS' in os.environ - old_address = os.environ.get('DJANGO_LIVE_TEST_SERVER_ADDRESS') - # If contrib.staticfiles isn't configured properly, the exception # should bubble up to the main thread. old_STATIC_URL = TEST_SETTINGS['STATIC_URL'] TEST_SETTINGS['STATIC_URL'] = None - cls.raises_exception('localhost:8081', ImproperlyConfigured) + cls.raises_exception() TEST_SETTINGS['STATIC_URL'] = old_STATIC_URL - # Restore original environment variable - if address_predefined: - os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = old_address - else: - del os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] - @classmethod def tearDownClass(cls): # skip it, as setUpClass doesn't call its parent either pass @classmethod - def raises_exception(cls, address, exception): - os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = address + def raises_exception(cls): try: super(StaticLiveServerChecks, cls).setUpClass() raise Exception("The line above should have raised an exception") - except exception: + except ImproperlyConfigured: + # This raises ImproperlyConfigured("You're using the staticfiles + # app without having set the required STATIC_URL setting.") pass finally: super(StaticLiveServerChecks, cls).tearDownClass() |
