summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-23 12:04:05 -0400
committerGitHub <noreply@github.com>2016-06-23 12:04:05 -0400
commit81cdcb66bc74a0768d13f0e18872d46739028e64 (patch)
treea7b0c5577f17242f992ebc308acfccc738635d0a /tests/staticfiles_tests
parentb5a1c3a6f50362b57603e1833e44bff5628dde3c (diff)
Fixed #26791 -- Replaced LiveServerTestCase port ranges with binding to port 0.
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/test_liveserver.py19
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()