Skip to content

Commit 6e7158b

Browse files
authored
Merge pull request jazzband#516 from jayvdb/allow-sqlite-testing
Allow running tests using sqlite
2 parents 89b7662 + 7096314 commit 6e7158b

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

tests/settings.py

+19-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,25 @@
44
'model_utils',
55
'tests',
66
)
7-
DATABASES = {
8-
"default": {
9-
"ENGINE": "django.db.backends.postgresql_psycopg2",
10-
"NAME": os.environ.get("DB_NAME", "modelutils"),
11-
"USER": os.environ.get("DB_USER", 'postgres'),
12-
"PASSWORD": os.environ.get("DB_PASSWORD", ""),
13-
"HOST": os.environ.get("DB_HOST", "localhost"),
14-
"PORT": os.environ.get("DB_PORT", 5432)
15-
},
16-
}
7+
8+
if os.environ.get('SQLITE'):
9+
DATABASES = {
10+
'default': {
11+
'ENGINE': 'django.db.backends.sqlite3',
12+
},
13+
}
14+
else:
15+
DATABASES = {
16+
"default": {
17+
"ENGINE": "django.db.backends.postgresql",
18+
"NAME": os.environ.get("DB_NAME", "modelutils"),
19+
"USER": os.environ.get("DB_USER", 'postgres'),
20+
"PASSWORD": os.environ.get("DB_PASSWORD", ""),
21+
"HOST": os.environ.get("DB_HOST", "localhost"),
22+
"PORT": os.environ.get("DB_PORT", 5432)
23+
},
24+
}
25+
1726
SECRET_KEY = 'dummy'
1827

1928
CACHES = {

0 commit comments

Comments
 (0)