Django: Change Logging Level During Tests

So you’ve been a good developer and using the logger instead of print statements. You can change the log level and make DEBUG statements appear or disappear. How to do this when you are running tests? Just add something like this to tests.py:

import logging
logging.disable(logging.CRITICAL)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s