manage.py test doesn't respect DEBUG setting

41 views
Skip to first unread message

Rosemary McCloskey

unread,
Feb 7, 2014, 6:36:56 PM2/7/14
to django...@googlegroups.com
Hello,

I am trying to run unit tests on my project, and the DEBUG setting is not being preserved during the tests. I'm using Django 1.6.1, with Python 2.7.3 on Ubuntu 12.04.

My settings file looks like this:

DEBUG = True
ADMINS = (
('Rosemary McCloskey', 'rmcclo...@gmail.com')
)
# more stuff

I made a tests file called "metadata/tests.py", with the following contents:

from django.conf import settings
print(settings.ADMINS)
print(settings.DEBUG)

It prints out:

('Rosemary McCloskey', 'rmcclo...@gmail.com')
False

So for some reason, the DEBUG setting is not being preserved during testing, but all the other settings are (I have also tried printing out settings.DATABASES and settings.INSTALLED_APPS, and they are preserved). Is this normal Django behaviour? I couldn't find any reference to it in the docs. Do you have any ideas about how I could get around this (the code has some conditional imports based on DEBUG and I don't want to remove them)?

Thanks for your help,

Rosemary

Rosemary McCloskey

unread,
Feb 7, 2014, 7:00:00 PM2/7/14
to django...@googlegroups.com
I'm sorry, please disregard this email. I found the answer in the documentation.
Reply all
Reply to author
Forward
0 new messages