#24965: Make LiveServerTestCase.live_server_url accessible from class
-------------------------------------+-------------------------------------
     Reporter:  MoritzS              |                    Owner:  MoritzS
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Testing framework    |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  selenium tests live  |             Triage Stage:  Accepted
  server test case url               |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by timgraham):

 Right, I was thinking something like this:
 {{{
 #!diff
 diff --git a/tests/servers/tests.py b/tests/servers/tests.py
 index e84b878..0636a13 100644
 --- a/tests/servers/tests.py
 +++ b/tests/servers/tests.py
 @@ -9,6 +9,7 @@ import socket

  from django.core.exceptions import ImproperlyConfigured
  from django.test import LiveServerTestCase, override_settings
 +from django.utils import six
  from django.utils._os import upath
  from django.utils.http import urlencode
  from django.utils.six.moves.urllib.error import HTTPError
 @@ -71,6 +72,8 @@ class LiveServerAddress(LiveServerBase):
          else:
              del os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS']

 +        cls.live_server_url_type = type(cls.live_server_url)
 +
      @classmethod
      def tearDownClass(cls):
          # skip it, as setUpClass doesn't call its parent either
 @@ -92,6 +95,9 @@ class LiveServerAddress(LiveServerBase):
          # test runner and the overridden setUpClass() method is executed.
          pass

 +    def test_live_server_url_is_class_property(self):
 +        self.assertTrue(issubclass(self.live_server_url_type,
 six.text_type))
 +

  class LiveServerViews(LiveServerBase):
      def test_404(self):
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24965#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.f2fa0827cd9977b2689dbf78ba6eaecc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to