Projet

Général

Profil

0002-tox-provide-pg-test-venvs-43916.patch

Paul Marillonnet, 11 juin 2020 12:27

Télécharger (2,18 ko)

Voir les différences:

Subject: [PATCH 2/3] tox: provide pg test venvs (#43916)

 Jenkinsfile       |  2 +-
 tests/settings.py | 12 ++++++++++--
 tox.ini           | 11 +++++++++--
 3 files changed, 20 insertions(+), 5 deletions(-)
Jenkinsfile
4 4
    agent any
5 5
    options {
6 6
        disableConcurrentBuilds()
7
        timeout(time: 10, unit: 'MINUTES')
7
        timeout(time: 18, unit: 'MINUTES')
8 8
    }
9 9
    stages {
10 10
        stage('Unit Tests') {
tests/settings.py
1
DATABASES['default']['TEST'] = {
2
    'NAME': 'test-db.sqlite3',
1
DATABASES = {
2
    'default': {
3
        'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3'),
4
        'NAME': 'combo-test-db',
5
    }
3 6
}
4 7

  
8
if 'postgres' in DATABASES['default']['ENGINE']:
9
    for key in ('PGPORT', 'PGHOST', 'PGUSER', 'PGPASSWORD'):
10
        if key in os.environ:
11
            DATABASES['default'][key[2:]] = os.environ[key]
12

  
5 13
LANGUAGE_CODE = 'en-us'
6 14

  
7 15
KNOWN_SERVICES = {
tox.ini
1 1
[tox]
2 2
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo/{env:BRANCH_NAME:}
3
envlist = coverage-py3-django111-pylint,py3-django22
3
envlist = coverage-py3-django111-pylint-{sqlite,pg},py3-django22-{sqlite,pg}
4 4

  
5 5
[testenv]
6 6
usedevelop = True
......
9 9
  COMBO_SETTINGS_FILE=tests/settings.py
10 10
  TOX_WORK_DIR={toxworkdir}
11 11
  coverage: COVERAGE=--cov-report xml --cov-report html --cov=combo/
12
  pg: DB_ENGINE=django.db.backends.postgresql_psycopg2
13
passenv =
14
  BRANCH_NAME
15
  PGPORT
16
  PGHOST
17
  PGUSER
18
  PGPASSWORD
12 19
deps =
13 20
  django111: django>=1.11,<1.12
14 21
  django22: django>=2.2,<2.3
......
23 30
  pylint<1.8
24 31
  pylint-django<0.8.1
25 32
  django-webtest<1.9.3
26
  psycopg2
33
  pg: psycopg2-binary
27 34
  django-mellon>=1.13
28 35
  quixote>=3.0
29 36
  vobject
30
-