tox.ini: refactor and adapt for py3 and dj22 (#42801)

This commit is contained in:
Benjamin Dauvergne 2020-05-12 22:12:54 +02:00
parent d377e55090
commit 4bb0f21480
3 changed files with 80 additions and 32 deletions

22
getlasso3.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
# Get venv site-packages path
DSTDIR=`python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
# Get not venv site-packages path
# Remove first path (assuming that is the venv path)
NONPATH=`echo $PATH | sed 's/^[^:]*://'`
SRCDIR=`PATH=$NONPATH python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
# Clean up
rm -f $DSTDIR/lasso.*
rm -f $DSTDIR/_lasso.*
# Link
ln -sv /usr/lib/python3/dist-packages/lasso.py $DSTDIR/
for SOFILE in /usr/lib/python3/dist-packages/_lasso.cpython-*.so
do
ln -sv $SOFILE $DSTDIR/
done
exit 0

View File

@ -1,6 +1,7 @@
#!/bin/sh
#!/bin/bash
set -e
set -e -x
if [ -f /var/lib/jenkins/pylint.django.rc ]; then
PYLINT_RC=/var/lib/jenkins/pylint.django.rc
elif [ -f pylint.django.rc ]; then
@ -9,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

83
tox.ini
View File

@ -5,43 +5,68 @@
[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic2-wallonie-connect/{env:BRANCH_NAME:}
envlist = py27-dj111-pg-coverage
envlist =
py2-dj111-drf34
py3-dj111-drf34
py3-dj22-drf39
[tox:jenkins]
envlist =
pylint
py2-dj111-drf34
py3-dj111-drf34
py3-dj22-drf39
[testenv]
# django.contrib.auth is not tested it does not work with our templates
basepython = python2
setenv =
AUTHENTIC2_SETTINGS_FILE=tests/settings.py
DJANGO_SETTINGS_MODULE=authentic2.settings
pg: DB_ENGINE=django.db.backends.postgresql_psycopg2
coverage: COVERAGE=--junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=src/ --cov-config .coveragerc
fast: FAST=--nomigrations
DB_ENGINE=django.db.backends.postgresql_psycopg2
JUNIT={tty::-o junit_suite_name={envname} --junit-xml=junit-{envname}.xml}
COVERAGE={tty::--junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=src/ --cov-config .coveragerc}
usedevelop =
coverage: True
nocoverage: False
deps =
dj111: django>=1.11,<1.12
dj111: django-tables2>=1.1,<2
pg: psycopg2
coverage
pytest-cov
pytest-django<3.4.6
Pillow<7
mock
pytest
lxml
cssselect
pylint<1.8
pylint-django<0.8.1
django-webtest<1.9.3
WebTest
pyquery
httmock
pytz
requests
pytest-freezegun
http://git.entrouvert.org/authentic.git/snapshot/authentic-master.tar.gz
# dependency constraints for authentic
py2: django-appconf<1.0.4
py2: django-filter<2
drf34: djangorestframework>=3.4,<3.4.1
drf39: djangorestframework>=3.9.2,<3.10
dj111: django<2.0
dj22: django<2.3
django-tables<2.0
psycopg2-binary
# pytest requirements
pytest
pytest-cov
pytest-django
django-webtest
pyquery
commands =
./getlasso.sh
dj111: ./pylint.sh src/authentic2_wallonie_connect
py.test {env:FAST:} {env:COVERAGE:} {posargs:tests/}
py2: ./getlasso.sh
py3: ./getlasso3.sh
py.test {env:COVERAGE:} {env:JUNIT:} {tty:--sw:} {posargs:tests/}
[testenv:pylint]
skip_install = True
deps =
http://git.entrouvert.org/authentic.git/snapshot/authentic-master.tar.gz
Django<2.3
pylint
pylint-django
commands =
/bin/bash -c "./pylint.sh src/*/"
[pytest]
filterwarnings =
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\..*