Skip to content

Commit

Permalink
Merge pull request #516 from jayvdb/allow-sqlite-testing
Browse files Browse the repository at this point in the history
Allow running tests using sqlite
  • Loading branch information
foarsitter authored Mar 21, 2024
2 parents 89b7662 + 7096314 commit 6e7158b
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@
'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",
"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 = {
Expand Down

0 comments on commit 6e7158b

Please sign in to comment.