Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Why does django's default test suite runner set settings.DEBUG = False? [RSS Feed]

#1 June 16, 2010 22:40:49

Peter B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why does django's default test suite runner set settings.DEBUG = False?


This is a new feature of Django 1.2. I'm curious, why does it want to
do this? I want to control this for my settings so that I can things
like disabled verify_exists on my URLFields when I run tests.


# django/test/simple.py
class DjangoTestSuiteRunner(object):
def __init__(self, verbosity=1, interactive=True, failfast=True,
**kwargs):
self.verbosity = verbosity
self.interactive = interactive
self.failfast = failfast

def setup_test_environment(self, **kwargs):
setup_test_environment()
settings.DEBUG = False
...

What's the benefit? Is it important?

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 17, 2010 01:14:31

Russell K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why does django's default test suite runner set settings.DEBUG = False?


On Thu, Jun 17, 2010 at 5:40 AM, Peter Bengtsson <pete...@gmail.com> wrote:
> This is a new feature of Django 1.2. I'm curious, why does it want to
> do this? I want to control this for my settings so that I can things
> like disabled verify_exists on my URLFields when I run tests.

No, it isn't a new feature at all. It's been there since the test
system was introduced almost 4 years ago.http://code.djangoproject.com/browser/django/trunk/django/test/simple.py?rev=3658#L55Here's the reasoning:
* Production code should always be running in DEBUG=False, and you
should be testing how your code will operate in production. It would
be a pain to have to manually set (and, more importantly, to remember
to set) DEBUG=True every time you run your test suite, so we do it for
you.
* DEBUG=True will be marginally faster, because it doesn't collect
various debug/traceback information during execution. In a big test
suite, every little bit matters.

Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 17, 2010 14:35:48

Tom E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why does django's default test suite runner set settings.DEBUG = False?


On Thu, Jun 17, 2010 at 1:14 AM, Russell Keith-Magee
<russ...@keith-magee.com> wrote:
> On Thu, Jun 17, 2010 at 5:40 AM, Peter Bengtsson <pete...@gmail.com> wrote:
>> This is a new feature of Django 1.2. I'm curious, why does it want to
>> do this? I want to control this for my settings so that I can things
>> like disabled verify_exists on my URLFields when I run tests.
>
> No, it isn't a new feature at all. It's been there since the test
> system was introduced almost 4 years ago.
>
>http://code.djangoproject.com/browser/django/trunk/django/test/simple.py?rev=3658#L55>
> Here's the reasoning:
>  * Production code should always be running in DEBUG=False, and you
> should be testing how your code will operate in production. It would
> be a pain to have to manually set (and, more importantly, to remember
> to set) DEBUG=True every time you run your test suite, so we do it for
> you.
>  * DEBUG=True will be marginally faster, because it doesn't collect

<pedant>DEBUG=False will be marginally faster</pedant>

> various debug/traceback information during execution. In a big test
> suite, every little bit matters.
>
> Yours,
> Russ Magee %-)
>

The intent was clear :)

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Why does django's default test suite runner set settings.DEBUG = False? [RSS Feed]

Board footer

Moderator control

Enjoy the 14th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support