tests: use pg_virtualenv with on jenkins (#27083)

This commit is contained in:
Benjamin Dauvergne 2019-05-03 11:54:14 +02:00
parent ce56e15d0b
commit 7f191e9bc6
3 changed files with 10 additions and 1 deletions

View File

@ -11,4 +11,4 @@ done
virtualenv venv
venv/bin/pip install tox
venv/bin/tox -rv
PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0)); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` pg_virtualenv -o fsync=off venv/bin/tox -rv

View File

@ -9,3 +9,8 @@ DATABASES = {
},
}
}
if 'postgres' in DATABASES['default']['ENGINE']:
for key in ('PGPORT', 'PGHOST', 'PGUSER', 'PGPASSWORD'):
if key in os.environ:
DATABASES['default'][key[2:]] = os.environ[key]

View File

@ -18,6 +18,10 @@ setenv =
pg: DB_ENGINE=django.db.backends.postgresql_psycopg2
coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=src/ --cov-config .coveragerc
fast: FAST=--nomigrations
PGPORT={env:PGPORT:}
PGHOST={env:PGHOST:}
PGUSER={env:PGUSER:}
PGPASSWORD={env:PGPASSWORD:}
usedevelop =
coverage: True
nocoverage: False