I am using the storages.backends.s3boto.S3BotoStorage for my DEFAULT_FILE_STORAGE in a Django project.
Ideally I would like to either use the default FileSystemStorage during unit tests or perhaps create a temporary bucket that is deleted on the conclusion of the tests.
What is the best way to accomplish this?
I typically keep a separate settings file for tests,
test.py. You can configure the storage backend there, as well as any other settings you want to change during tests. Then, run the tests like this:The
--settingsflag is the dotted path the the settings module you want to use (The default would beproject.settings).Good optimizations for a test settings file: https://web.archive.org/web/20180204071529/http://www.daveoncode.com/2013/09/23/effective-tdd-tricks-to-speed-up-django-tests-up-to-10x-faster/
Two Scoops of Django is a good place to read about the multi-settings file setup.