commit e6833a2d52849e01dfeb3fe4a88093678fd88d93 Author: John Vandenberg Date: Sun Dec 26 12:31:12 2021 +0800 Allow running tests using sqlite diff --git a/tests/settings.py b/tests/settings.py index 4ead542..83946b3 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -4,16 +4,25 @@ INSTALLED_APPS = ( 'model_utils', 'tests', ) -DATABASES = { - "default": { - "ENGINE": "django.db.backends.postgresql_psycopg2", - "NAME": os.environ.get("DB_NAME", "modelutils"), - "USER": os.environ.get("DB_USER", 'postgres'), - "PASSWORD": os.environ.get("DB_PASSWORD", ""), - "HOST": os.environ.get("DB_HOST", "localhost"), - "PORT": os.environ.get("DB_PORT", 5432) - }, -} + +if os.environ.get('SQLITE'): + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + }, + } +else: + DATABASES = { + "default": { + "ENGINE": "django.db.backends.postgresql_psycopg2", + "NAME": os.environ.get("DB_NAME", "modelutils"), + "USER": os.environ.get("DB_USER", 'postgres'), + "PASSWORD": os.environ.get("DB_PASSWORD", ""), + "HOST": os.environ.get("DB_HOST", "localhost"), + "PORT": os.environ.get("DB_PORT", 5432) + }, + } + SECRET_KEY = 'dummy' CACHES = {