Projet

Général

Profil

0001-tests-use-postgres-instead-of-sqlite-42500.patch

Nicolas Roche, 25 mai 2020 09:39

Télécharger (3,04 ko)

Voir les différences:

Subject: [PATCH] tests: use postgres instead of sqlite (#42500)

 config_example.py      | 2 +-
 passerelle/settings.py | 2 +-
 tests/settings.py      | 2 +-
 tox.ini                | 4 +---
 4 files changed, 4 insertions(+), 6 deletions(-)
config_example.py
3 3
SECRET_KEY = 'changeme'
4 4

  
5 5
MEDIA_ROOT = 'media'
6 6

  
7 7
STATIC_ROOT = 'collected-static'
8 8

  
9 9
DATABASES = {
10 10
    'default': {
11
        'ENGINE': 'django.db.backends.sqlite3',
11
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
12 12
        'NAME':  'passerelle.sqlite3',
13 13
    }
14 14
}
passerelle/settings.py
26 26
# SECURITY WARNING: don't run with debug turned on in production!
27 27
DEBUG = True
28 28

  
29 29
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
30 30
ALLOWED_HOSTS = []
31 31

  
32 32
DATABASES = {
33 33
    'default': {
34
        'ENGINE': 'django.db.backends.sqlite3',
34
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
35 35
        'NAME': 'passerelle.sqlite3',
36 36
    }
37 37
}
38 38

  
39 39
### End of "Quick-start development settings"
40 40

  
41 41

  
42 42
# If you set this to False, Django will not format dates, numbers and
tests/settings.py
55 55
    },
56 56
    'dummy': {
57 57
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache'
58 58
    }
59 59
}
60 60

  
61 61
DATABASES = {
62 62
    'default': {
63
        'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3'),
63
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
64 64
        'TEST': {
65 65
            'NAME': 'passerelle-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:63],
66 66
        },
67 67
    }
68 68
}
69 69

  
70 70
LOGGED_REQUESTS_MAX_SIZE = 4999
tox.ini
1 1
[tox]
2 2
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/{env:BRANCH_NAME:}
3
envlist = py2-django111-pg-junit, py3-django111-pg-coverage
3
envlist = py2-django111-junit, py3-django111-coverage
4 4

  
5 5
[testenv]
6 6
usedevelop = True
7 7
setenv =
8 8
  DJANGO_SETTINGS_MODULE=passerelle.settings
9 9
  PASSERELLE_SETTINGS_FILE=tests/settings.py
10 10
  BRANCH_NAME={env:BRANCH_NAME:}
11 11
  WCSCTL=wcs/wcsctl.py
12 12
  fast: FAST=--nomigrations
13
  sqlite: DB_ENGINE=django.db.backends.sqlite3
14
  pg: DB_ENGINE=django.db.backends.postgresql_psycopg2
15 13
  coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=passerelle/ --cov-config .coveragerc -Wignore
16 14
  junit: JUNIT=--junitxml=junit-{envname}.xml
17 15
deps =
18 16
  django111: django>=1.11,<1.12
19 17
  psycopg2-binary
20 18
  pytest-cov
21 19
  pytest-django
22 20
  pytest
23
-