summaryrefslogtreecommitdiff
path: root/tests/servers
diff options
context:
space:
mode:
authorMoritz Sichert <moritz.sichert@googlemail.com>2015-06-10 22:57:51 +0200
committerTim Graham <timograham@gmail.com>2015-06-12 17:44:54 -0400
commit296919e7a58c21ff0325de8c747dc2dc8960104e (patch)
tree085278b68130a6127b7f02200ebb3c742d05317a /tests/servers
parente93e0c03b28137e26f9249e0b7c458b0d667a74e (diff)
Fixed #24965 -- Made LiveServerTestCase.live_server_url accessible from class
Diffstat (limited to 'tests/servers')
-rw-r--r--tests/servers/tests.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/servers/tests.py b/tests/servers/tests.py
index e84b8788c0..3ba80cc23d 100644
--- a/tests/servers/tests.py
+++ b/tests/servers/tests.py
@@ -11,6 +11,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.test import LiveServerTestCase, override_settings
from django.utils._os import upath
from django.utils.http import urlencode
+from django.utils.six import text_type
from django.utils.six.moves.urllib.error import HTTPError
from django.utils.six.moves.urllib.request import urlopen
@@ -71,6 +72,9 @@ class LiveServerAddress(LiveServerBase):
else:
del os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS']
+ # put it in a list to prevent descriptor lookups in test
+ cls.live_server_url_test = [cls.live_server_url]
+
@classmethod
def tearDownClass(cls):
# skip it, as setUpClass doesn't call its parent either
@@ -87,10 +91,9 @@ class LiveServerAddress(LiveServerBase):
finally:
super(LiveServerAddress, cls).tearDownClass()
- def test_test_test(self):
- # Intentionally empty method so that the test is picked up by the
- # test runner and the overridden setUpClass() method is executed.
- pass
+ def test_live_server_url_is_class_property(self):
+ self.assertIsInstance(self.live_server_url_test[0], text_type)
+ self.assertEqual(self.live_server_url_test[0], self.live_server_url)
class LiveServerViews(LiveServerBase):