It's probably safer to use a separate runtests module and change the django settings in that module.