From 2ce0efa30a06a9990fb2ae2e7e0be1914a10f745 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sat, 22 Apr 2023 14:58:39 +0200 Subject: [PATCH] tox.ini: run in pg_virtualenv (#75513) --- tests/settings.py | 5 +++++ tox.ini | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/settings.py b/tests/settings.py index dc36d4c..b73ca8a 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -4,3 +4,8 @@ BIJOE_INIT_SQL = [ ] PAGE_LENGTH = 0 SELECT2_CACHE_PREFIX = 'select2_' + +if 'postgres' in DATABASES['default']['ENGINE']: + for key in ('PGPORT', 'PGHOST', 'PGUSER', 'PGPASSWORD'): + if key in os.environ: + DATABASES['default'][key[2:]] = os.environ[key] diff --git a/tox.ini b/tox.ini index d9eeaf4..523669a 100644 --- a/tox.ini +++ b/tox.ini @@ -44,9 +44,10 @@ deps = django32: Django-Select2>7.7,<7.8 django32: djangorestframework>=3.7 django32: https://git.entrouvert.org/entrouvert/hobo/archive/main.tar.gz +allowlist_externals = pg_virtualenv commands = python setup.py compile_translations - py3-django32: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=bijoe --cov-config=tox.ini --numprocesses {env:NUMPROCESSES:1} tests/} + pg_virtualenv -owal_level=minimal -omax_wal_senders=0 -owal_log_hints=off -ocheckpoint_timeout=1d -osynchronous_commit=off -ofull_page_writes=off -ofsync=off py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=bijoe --cov-config=tox.ini --numprocesses {env:NUMPROCESSES:1} tests/} [pytest] filterwarnings =