On Wed, Nov 25, 2009 at 4:10 PM, Alex Dong <alex.d...@gmail.com> wrote: > Hi all, > > During the `manage.py test` process, django will automatically change > the database from `hivemind` to `test_hivemind`, For similar reason, > I'd like to change a file path from `sphinx.conf` to > `sphinx_test.conf` but unfortunately I couldn't find a proper way to > do it. > > Ideally, if there is a django method called `django.test.is_testing() > `, then I should be able to change the filename based on the return > value. Any hints on how I could do this?
You shouldn't. Code shouldn't be aware that it is being run in a test. Introducing 'if TESTING' branches into code introduces extra complexity into the code you are trying to test - complexity that, by definition, is untestable. If you need to modify a setting for testing purposes, then do the same thing that the Django test suite does - in your test setUp() method, modify the value of the setting, then restore the original value during tearDown(). 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.