tox: add django 2.2 / DRF 3.4 / DRF 3.9 test venv (#41238)

This commit is contained in:
Paul Marillonnet 2020-04-22 14:46:01 +02:00 committed by Benjamin Dauvergne
parent dd80c4722d
commit df3e0e79de
3 changed files with 46 additions and 19 deletions

2
Jenkinsfile vendored
View File

@ -13,7 +13,7 @@ pipeline {
sh """ sh """
virtualenv -p python3 ${env.TMPDIR}/venv/ virtualenv -p python3 ${env.TMPDIR}/venv/
${env.TMPDIR}/venv/bin/pip install tox "virtualenv<=20.0.5" "importlib-resources<=1.0.2" ${env.TMPDIR}/venv/bin/pip install tox "virtualenv<=20.0.5" "importlib-resources<=1.0.2"
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 ${env.TMPDIR}/venv/bin/tox -rv""" 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 ${env.TMPDIR}/venv/bin/tox -r"""
} }
post { post {
always { always {

View File

@ -10,4 +10,4 @@ else
echo No pylint RC found echo No pylint RC found
exit 0 exit 0
fi fi
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true pylint -f parseable --rcfile ${PYLINT_RC} "$@" > pylint.out || /bin/true

61
tox.ini
View File

@ -5,14 +5,31 @@
[tox] [tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic/ toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic/
envlist = py27-coverage-dj111-authentic-pg-{oldldap,},{py27,py3}-coverage-dj111-rbac-pg,pylint,py3-coverage-authentic-dj111-pg envlist =
rbac-py2-dj111
rbac-py3-{dj111,dj22}
authentic-py2-dj111-oldldap
authentic-py2-dj111-drf34
authentic-py3-dj111-drf34
authentic-py3-dj22-drf39
[tox:jenkins]
envlist =
pylint
rbac-py3-dj22
authentic-py2-dj111-drf34
authentic-py3-dj111-drf34
authentic-py3-dj22-drf39
[testenv] [testenv]
whitelist_externals = whitelist_externals =
/bin/mv /bin/mv
setenv = setenv =
AUTHENTIC2_SETTINGS_FILE=tests/settings.py AUTHENTIC2_SETTINGS_FILE=tests/settings.py
BRANCH_NAME={env:BRANCH_NAME:}
authentic: DJANGO_SETTINGS_MODULE=authentic2.settings authentic: DJANGO_SETTINGS_MODULE=authentic2.settings
rbac: DJANGO_SETTINGS_MODULE=django_rbac.test_settings rbac: DJANGO_SETTINGS_MODULE=django_rbac.test_settings
@ -21,24 +38,27 @@ setenv =
authentic-oldldap: TESTS=tests/test_ldap.py authentic-oldldap: TESTS=tests/test_ldap.py
rbac: TESTS=tests_rbac/ rbac: TESTS=tests_rbac/
pg: DB_ENGINE=django.db.backends.postgresql_psycopg2 DB_ENGINE=django.db.backends.postgresql_psycopg2
JUNIT={tty::-o junit_suite_name={envname} --junit-xml=junit-{envname}.xml} JUNIT={tty::-o junit_suite_name={envname} --junit-xml=junit-{envname}.xml}
coverage: COVERAGE=--cov=src --cov-branch --cov-append --cov-report xml --cov-report html COVERAGE={tty::--cov=src --cov-branch --cov-append --cov-report xml --cov-report html}
fast: FAST=--nomigrations fast: FAST=--nomigrations
reusedb: REUSEDB=--reuse-db reusedb: REUSEDB=--reuse-db
passenv=
BRANCH_NAME
# support for pg_virtualenv # support for pg_virtualenv
PGPORT={env:PGPORT:} PGPORT
PGHOST={env:PGHOST:} PGHOST
PGUSER={env:PGUSER:} PGUSER
PGPASSWORD={env:PGPASSWORD:} PGPASSWORD
usedevelop = true usedevelop = true
deps = deps =
pip > 9 pip > 9
dj111: django<2.0 dj111: django<2.0
dj111: django-tables<2.0 dj22: django<2.3
pg: psycopg2-binary django-tables<2.0
psycopg2-binary
coverage coverage
pytest-cov pytest-cov
pytest-django<3.4.6 pytest-django<3.4.6
@ -57,12 +77,14 @@ deps =
enum34<=1.1.6 enum34<=1.1.6
ldaptools>=0.15 ldaptools>=0.15
oldldap: python-ldap<3 oldldap: python-ldap<3
py27: django-appconf<1.0.4 py2: django-appconf<1.0.4
py27: django-filter<2 py2: django-filter<2
drf34: djangorestframework>=3.4,<3.5
drf39: djangorestframework>=3.9.2,<3.10
commands = commands =
py27: ./getlasso.sh py2: ./getlasso.sh
py3: ./getlasso3.sh py3: ./getlasso3.sh
rbac,authentic: py.test {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {posargs:{env:TESTS} --random-group} rbac,authentic: py.test {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {tty:--sw:} {posargs:{env:TESTS} --random-group}
[testenv:pylint] [testenv:pylint]
basepython = python2.7 basepython = python2.7
@ -88,6 +110,11 @@ commands =
[pytest] [pytest]
filterwarnings = filterwarnings =
ignore:on_delete.* error
once:.* # there is nothing we can do about that
junit_family=legacy ignore:defusedxml.lxml is no longer supported:DeprecationWarning:openpyxl.xml.functions
ignore:Using or importing the ABCs from 'collections':DeprecationWarning:django.*
ignore:Role QuerySet won't use Meta.ordering::django\..*
# remind us later
once:.*staticfiles.*::django\..*
junit_family=xunit2