Django: why i can't get the tracebacks (in case of error) when i run LiveServerTestCase tests? Django: why i can't get the tracebacks (in case of error) when i run LiveServerTestCase tests? selenium selenium

Django: why i can't get the tracebacks (in case of error) when i run LiveServerTestCase tests?


from the django docs https://docs.djangoproject.com/en/1.4/topics/testing/#other-test-conditions

Seems not possible to override this at this moment, even with https://docs.djangoproject.com/en/1.4/topics/testing/#django.test.utils.override_settings

the only way to see the debug information when it's returned a 500 response is by logging it.

edit: i've found a way to set DEBUG = True in my selenium tests.In my subclass, i override the constructor and change the setting.

from django.conf import settingsclass SeleniumLiveServerTestCase(LiveServerTestCase):    def __init__(self, *args, **kwargs):        super(SeleniumLiveServerTestCase, self).__init__(*args, **kwargs)        if settings.DEBUG == False:            settings.DEBUG = True

it's ugly but works!


I ran into the same issue and it is now possible to override settings.

based on your example you would import override_settings and place the decorator above the class:

from django.test import override_settings@override_settings(DEBUG=True)class SeleniumLiveServerTestCase(LiveServerTestCase):    ...

details in django docs


I'm not terribly familiar with the Selenium test suite, myself, but I do know that if you are deploying the application and your IP address is not registered in the "INTERNAL_IPS" tuple, you may not see tracebacks even if DEBUG is set to True. When you use Django's runserver, it adds your local machine to the INTERNAL_IPS setting automatically, however normally this is an empty tuple. My bet is that Selenium isn't doing that for you and that may be why you don't see tracebacks. I'd try adding that, if you haven't already.

Something like this should work fine:

INTERNAL_IPS = ('127.0.0.1',)

Django Settings (INTERNAL_IPS)