Projet

Général

Profil

0002-tests-use-pg_virtualenv-with-on-jenkins-27083.patch

Benjamin Dauvergne, 03 mai 2019 16:48

Télécharger (1,65 ko)

Voir les différences:

Subject: [PATCH 2/2] tests: use pg_virtualenv with on jenkins (#27083)

 jenkins.sh        | 2 +-
 tests/settings.py | 5 +++++
 tox.ini           | 4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)
jenkins.sh
11 11

  
12 12
virtualenv venv
13 13
venv/bin/pip install tox
14
venv/bin/tox -rv
14
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
tests/settings.py
9 9
        },
10 10
    }
11 11
}
12

  
13
if 'postgres' in DATABASES['default']['ENGINE']:
14
    for key in ('PGPORT', 'PGHOST', 'PGUSER', 'PGPASSWORD'):
15
        if key in os.environ:
16
            DATABASES['default'][key[2:]] = os.environ[key]
tox.ini
18 18
  pg: DB_ENGINE=django.db.backends.postgresql_psycopg2
19 19
  coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=src/ --cov-config .coveragerc
20 20
  fast: FAST=--nomigrations
21
  PGPORT={env:PGPORT:}
22
  PGHOST={env:PGHOST:}
23
  PGUSER={env:PGUSER:}
24
  PGPASSWORD={env:PGPASSWORD:}
21 25
usedevelop =
22 26
  coverage: True
23 27
  nocoverage: False
24
-