I am using a simple unit test based test runner to test my Django application.
My application itself is configured to use a basic logger in settings.py using:
<
I am using a simple method decorator to disable logging only in a particular test method.
def disable_logging(f):
def wrapper(*args):
logging.disable(logging.CRITICAL)
result = f(*args)
logging.disable(logging.NOTSET)
return result
return wrapper
And then I use it as in the following example:
class ScenarioTestCase(TestCase):
@disable_logging
test_scenario(self):
pass