tox.ini: refactor, add dj22 target

This commit is contained in:
Benjamin Dauvergne 2020-05-15 16:01:06 +02:00
parent bac72330f1
commit a5e4d42e02
3 changed files with 82 additions and 42 deletions

View File

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

View File

@ -1,13 +1,19 @@
import os
LANGUAGE_CODE = 'en'
ALLOWED_HOSTS = ['localhost']
DATABASES = {
'default': {
'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3'),
'TEST': {
'NAME': 'a2-test',
},
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'authentic2-cut',
}
}
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]
LANGUAGE_CODE = 'en'
A2_FC_CLIENT_ID = ''
A2_FC_CLIENT_SECRET = ''

100
tox.ini
View File

@ -5,45 +5,79 @@
[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic2-cut/{env:BRANCH_NAME:}
envlist = py{27,3}-coverage-dj111-pg
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
setenv =
AUTHENTIC2_SETTINGS_FILE=tests/settings.py
DJANGO_SETTINGS_MODULE=authentic2.settings
sqlite: DB_ENGINE=django.db.backends.sqlite3
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
usedevelop =
coverage: True
nocoverage: False
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}
passenv=
BRANCH_NAME
# support for pg_virtualenv
PGPORT
PGHOST
PGUSER
PGPASSWORD
usedevelop = true
deps =
dj111: django>=1.11,<1.12
dj111: django-tables2>=1.1,<2
pg: psycopg2
coverage
pytest-cov
pytest-django<3.4.6
mock
pytest
lxml
cssselect
pylint
pylint-django<0.8.1
django-webtest<1.9.3
WebTest
pyquery
httmock
pytz
requests
pytest-freezegun
enum34<=1.1.6
py27: django-appconf<1.0.4
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
oldldap: python-ldap<3
ldaptools
# pytest requirements
pytest
pytest-cov
pytest-django
pytest-freezegun
pytest-random
django-webtest
pyquery
commands =
py27: ./getlasso.sh
py2: ./getlasso.sh
py3: ./getlasso3.sh
dj111: ./pylint.sh src/authentic2_cut
py.test {env:FAST:} {env:COVERAGE:} {posargs:tests/}
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]
junit_family=xunit2
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:Using user.is_authenticated\(\) and user.is_anonymous\(\) as a method is deprecated.::rest_framework\.*
# remind us later
once:.*staticfiles.*::django\..*