Jenkinsfile: use pg_virtualenv to isolate the postgres database (#74887)
gitea/zoo/pipeline/head This commit looks good
Details
gitea/zoo/pipeline/head This commit looks good
Details
This commit is contained in:
parent
0440e461be
commit
9bdd837ecd
|
@ -5,7 +5,7 @@ pipeline {
|
|||
stages {
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
sh 'tox -rv'
|
||||
sh 'pg_virtualenv -o fsync=off tox -rv'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import os
|
||||
|
||||
from zoo.settings import *
|
||||
|
||||
# integrate with pg_virtualenv by getting pg configuration from environment variables
|
||||
for key in ('PGPORT', 'PGHOST', 'PGUSER', 'PGPASSWORD'):
|
||||
if key in os.environ:
|
||||
DATABASES['default'][key[2:]] = os.environ[key]
|
4
tox.ini
4
tox.ini
|
@ -10,8 +10,10 @@ envlist =
|
|||
py3-dj32
|
||||
|
||||
[testenv]
|
||||
passenv=
|
||||
PG*
|
||||
setenv =
|
||||
DJANGO_SETTINGS_MODULE=zoo.settings
|
||||
DJANGO_SETTINGS_MODULE=tests.settings
|
||||
SETUPTOOLS_USE_DISTUTILS=stdlib
|
||||
JUNIT={tty::--junitxml=junit-{envname}.xml}
|
||||
COVERAGE={tty::--cov-report xml --cov-report html --cov=zoo/}
|
||||
|
|
Loading…
Reference in New Issue