# app/test_functional_something.py
import os
if 'DJANGO_SETTINGS_MODULE' in os.env:
from django.tests import StaticLiveServerTestCase
FunctionalTest = StaticLiveServerTestCase
else:
class FunctionalTest(unittest.TestCase):
live_server_url = 'http://superlists-staging.ottg.eu'
$ python manage.py test
$ python -m unittest discover -p 'test_functional_*.py'
class FixedPortServerThread(LiveServerThread):
def _create_server(self, port):
if os.env.get('THROUGH_NGINX'):
return super(FixedPortServerThread, self)._create_server(port=8000)
else:
return super(FixedPortServerThread, self)._create_server(port=port)
class MyLiveServerTestCase(LiveServerTestCase):
server_thread_class = FixedPortServerThread
--
Harry Percival
+44 78877 02511
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/b74d3aa2-a033-4f98-a558-cdbbd68717d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Shouldn't A.url be a relative URL in this case?
I agree the ticket should be re-opened though, we had some pains working around this, but it was surmountable.
On 1 Jun 2017 15:31, "Francis Mwangi" <mw...@tumacredo.com> wrote:
please reopen the ticket, we are having a pain testing code that generating code. For instanceclass A(object):url = "some_url"test.pyclass TestingA(LiveserverTestcase):def test_a()
"we can't override the url defined in object A since its initialized even before we a have access to self.liveserver_url"
On Saturday, October 15, 2016 at 5:13:07 PM UTC+3, Tim Graham wrote:At the time of the implementation [0], no one raised that use case. Probably we can reopen the ticket and add it back.[0] https://groups.google.com/d/topic/django-developers/_TD8IkSLgqE/discussion
On Saturday, October 15, 2016 at 9:32:54 AM UTC-4, Andrew Wall wrote:Very much appreciate the Django framework.
I noticed in the docs for Django 1.11 that the DJANGO_LIVE_TEST_SERVER_ADDRESS environmental variable is slated to be removed, along with the accompanying
python manage.py test --liveserver option. I'm concerned that without the ability to specify a remote IP address using --liveserver, it will no longer be possible to run functional tests using selenium against an external server. I learned this technique from Harry Percival's excellent TDD with Python (see http://chimera.labs.oreilly.com/books/1234000000754/ch08.html#_configuring_domains_for_staging_and_live), where the test command is called from the local machine but you pass in the external IP. Will there be a different way to do this in Django 1.11? Perhaps the change to bind LiveserverTestCase to port zero by default can be made while retaining the option to pass in --liveserver? Realize the release is a ways away but would appreciate any help as I've come to rely on this method to test server deployments. Thank you!
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.