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 {
|
stages {
|
||||||
stage('Unit Tests') {
|
stage('Unit Tests') {
|
||||||
steps {
|
steps {
|
||||||
sh 'tox -rv'
|
sh 'pg_virtualenv -o fsync=off tox -rv'
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
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
|
py3-dj32
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
passenv=
|
||||||
|
PG*
|
||||||
setenv =
|
setenv =
|
||||||
DJANGO_SETTINGS_MODULE=zoo.settings
|
DJANGO_SETTINGS_MODULE=tests.settings
|
||||||
SETUPTOOLS_USE_DISTUTILS=stdlib
|
SETUPTOOLS_USE_DISTUTILS=stdlib
|
||||||
JUNIT={tty::--junitxml=junit-{envname}.xml}
|
JUNIT={tty::--junitxml=junit-{envname}.xml}
|
||||||
COVERAGE={tty::--cov-report xml --cov-report html --cov=zoo/}
|
COVERAGE={tty::--cov-report xml --cov-report html --cov=zoo/}
|
||||||
|
|
Loading…
Reference in New Issue