From df3e0e79de8185394108adfd8f22a2b8214f1a21 Mon Sep 17 00:00:00 2001 From: Paul Marillonnet Date: Wed, 22 Apr 2020 14:46:01 +0200 Subject: [PATCH] tox: add django 2.2 / DRF 3.4 / DRF 3.9 test venv (#41238) --- Jenkinsfile | 2 +- pylint.sh | 2 +- tox.ini | 61 ++++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 140741f7e..4910ce17d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { sh """ virtualenv -p python3 ${env.TMPDIR}/venv/ ${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 { always { diff --git a/pylint.sh b/pylint.sh index ec5303434..241d24c77 100755 --- a/pylint.sh +++ b/pylint.sh @@ -10,4 +10,4 @@ else echo No pylint RC found exit 0 fi -pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true +pylint -f parseable --rcfile ${PYLINT_RC} "$@" > pylint.out || /bin/true diff --git a/tox.ini b/tox.ini index 44847bc36..1233f236c 100644 --- a/tox.ini +++ b/tox.ini @@ -5,14 +5,31 @@ [tox] 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] whitelist_externals = /bin/mv setenv = + AUTHENTIC2_SETTINGS_FILE=tests/settings.py - BRANCH_NAME={env:BRANCH_NAME:} authentic: DJANGO_SETTINGS_MODULE=authentic2.settings rbac: DJANGO_SETTINGS_MODULE=django_rbac.test_settings @@ -21,24 +38,27 @@ setenv = authentic-oldldap: TESTS=tests/test_ldap.py 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} - 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 reusedb: REUSEDB=--reuse-db +passenv= + BRANCH_NAME # support for pg_virtualenv - PGPORT={env:PGPORT:} - PGHOST={env:PGHOST:} - PGUSER={env:PGUSER:} - PGPASSWORD={env:PGPASSWORD:} + PGPORT + PGHOST + PGUSER + PGPASSWORD usedevelop = true deps = pip > 9 dj111: django<2.0 - dj111: django-tables<2.0 - pg: psycopg2-binary + dj22: django<2.3 + django-tables<2.0 + psycopg2-binary coverage pytest-cov pytest-django<3.4.6 @@ -57,12 +77,14 @@ deps = enum34<=1.1.6 ldaptools>=0.15 oldldap: python-ldap<3 - py27: django-appconf<1.0.4 - py27: django-filter<2 + py2: django-appconf<1.0.4 + py2: django-filter<2 + drf34: djangorestframework>=3.4,<3.5 + drf39: djangorestframework>=3.9.2,<3.10 commands = - py27: ./getlasso.sh + py2: ./getlasso.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] basepython = python2.7 @@ -88,6 +110,11 @@ commands = [pytest] filterwarnings = - ignore:on_delete.* - once:.* -junit_family=legacy + error +# there is nothing we can do about that + 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