Re: Why does django's default test suite runner set settings.DEBUG = False?
On Thu, Jun 17, 2010 at 1:14 AM, Russell Keith-Magee wrote: > On Thu, Jun 17, 2010 at 5:40 AM, Peter Bengtsson 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 DEBUG=False will be marginally faster > 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 at http://groups.google.com/group/django-users?hl=en.
Re: Why does django's default test suite runner set settings.DEBUG = False?
On Thu, Jun 17, 2010 at 5:40 AM, Peter Bengtsson 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 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 at http://groups.google.com/group/django-users?hl=en.
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 at http://groups.google.com/group/django-users?hl=en.