Skip to content

Commit 57053f7

Browse files
committed
Add a stage which hopefully runs tests using PostgreSQL on Travis CI
1 parent bc3d377 commit 57053f7

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ matrix:
3838
env: TOXENV=py37-djmaster
3939
dist: xenial
4040
sudo: true
41+
- python: 3.6
42+
env: TOXENV=postgresql
43+
addons:
44+
postgresql: "9.5"
4145
- env: TOXENV=flake8
4246
- env: TOXENV=isort
4347
- env: TOXENV=readme

tests/settings.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,19 @@
8484
},
8585
}
8686

87-
DATABASES = {
88-
'default': {
89-
'ENGINE': 'django.db.backends.sqlite3',
87+
if os.environ.get("DJANGO_DATABASE_ENGINE") == "postgresql":
88+
DATABASES = {
89+
'default': {
90+
'ENGINE': 'django.db.backends.postgresql',
91+
'NAME': 'debug-toolbar',
92+
}
93+
}
94+
else:
95+
DATABASES = {
96+
'default': {
97+
'ENGINE': 'django.db.backends.sqlite3',
98+
}
9099
}
91-
}
92100

93101

94102
# Debug Toolbar configuration

tox.ini

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ envlist =
44
py{34,35,36,37}-dj20
55
py{35,36,37}-dj21
66
py{35,36,37}-djmaster
7+
postgresql,
78
flake8,
89
isort,
910
readme
@@ -25,6 +26,22 @@ whitelist_externals = make
2526
pip_pre = True
2627
commands = make coverage TEST_ARGS='{posargs:tests}'
2728

29+
[testenv:postgresql]
30+
deps =
31+
Django>=2.1,<2.2
32+
coverage
33+
django_jinja
34+
html5lib
35+
psycopg2-binary
36+
selenium<4.0
37+
sqlparse
38+
setenv =
39+
PYTHONPATH = {toxinidir}
40+
DJANGO_DATABASE_ENGINE = postgresql
41+
whitelist_externals = make
42+
pip_pre = True
43+
commands = make coverage TEST_ARGS='{posargs:tests}'
44+
2845
[testenv:flake8]
2946
basepython = python3
3047
commands = make flake8

0 commit comments

Comments
 (0)