Skip to content

Commit 8c67876

Browse files
committed
Added InMemoryStorage setting for Django>=4.2 tests
See https://docs.djangoproject.com/en/4.2/releases/4.2/#in-memory-file-storage.
1 parent 4e1ff90 commit 8c67876

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

runtests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ def __getitem__(self, item):
145145

146146
DEFAULT_SETTINGS["MIDDLEWARE"] = MIDDLEWARE
147147

148+
# DEV: Merge these settings into DEFAULT_SETTINGS when the minimum required
149+
# Django version is 4.2 or higher
150+
if django.VERSION >= (4, 2):
151+
DEFAULT_SETTINGS["STORAGES"] = {
152+
"default": {
153+
# Speeds up tests and prevents locally storing files created through them
154+
"BACKEND": "django.core.files.storage.InMemoryStorage",
155+
},
156+
}
157+
148158

149159
def main():
150160
parser = ArgumentParser(description="Run package tests.")

0 commit comments

Comments
 (0)