There are several options:
create a separate
test_settings
settings file for testing and then run tests via:python manage.py test --settings=test_settings
modify your
settings.py
on the fly iftest
is insys.argv
if 'test' in sys.argv: # modify MIDDLEWARE_CLASSES MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES) MIDDLEWARE_CLASSES.remove(<middleware_to_disable>)
Hope that helps.