From 76a8b603f5655e4f2d6fcf40652cfd5ad920488a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Leichtfu=C3=9F?= Date: Sat, 12 Sep 2020 21:26:17 +0200 Subject: [PATCH] [tests] speedup the tests a bit by using a in memory database --- tests/testapp/settings.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/testapp/settings.py b/tests/testapp/settings.py index a6e3b5a..1ce26bb 100644 --- a/tests/testapp/settings.py +++ b/tests/testapp/settings.py @@ -76,11 +76,15 @@ WSGI_APPLICATION = 'testapp.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases +if 'test' in sys.argv: + DB_NAME = ':memory:' +else: + DB_NAME = os.path.join(BASE_DIR, 'db.sqlite3') + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - # 'NAME': ':memory:', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'NAME': DB_NAME, } }