import sys
TEST = "manage.py', 'test'" in str(sys.argv)
There seems to be a more ordinary method, though.
if TEST:
import logging
logging.disable(logging.FATAL)
Reference: Temporarily suppress log output with logging.disable
Recommended Posts