I utilize the standard python logging module. When I call python manage.py test
I'd like to disable logging before all the tests are ran. Is there a signal or some other kind of hook I could use to call logging.disable? Or is there some other way to disable logging when python manage.py test
is ran?
views:
48answers:
3
+1
A:
The only way I know of is to edit manage.py
itself... not very elegant, of course, but at least it should get you to where you need to be.
Alex Martelli
2010-06-13 03:48:45
Ah, I hadn't thought of that (...well obviously). Thanks!
Eric Palakovich Carr
2010-06-13 13:20:33
@Eric, you're welcome!
Alex Martelli
2010-06-13 14:17:43
+1
A:
As an easy alternative, you can disable logging when running tests in your settings file like this:
if 'test' in sys.argv:
logger.removeHandler(handler)
logger.setLevel(logging.ERROR)
Dick
2010-09-26 14:04:20