use tox to run tests (#15562)

This commit is contained in:
Emmanuel Cazenave 2019-09-26 15:25:12 +02:00
parent 564f96ab82
commit d4600b2816
4 changed files with 39 additions and 22 deletions

5
.coveragerc Normal file
View File

@ -0,0 +1,5 @@
[run]
omit = wcs/ctl/Bouncers/*.py wcs/qommon/vendor/*.py
[report]
omit = wcs/ctl/Bouncers/*.py wcs/qommon/vendor/*.py

2
Jenkinsfile vendored
View File

@ -6,7 +6,7 @@ pipeline {
stages { stages {
stage('Unit Tests') { stage('Unit Tests') {
steps { steps {
sh './jenkins.sh' sh 'tox -r'
} }
post { post {
always { always {

15
pylint.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
set -e -x
env
if [ -f /var/lib/jenkins/pylint.wcs.rc ]; then
PYLINT_RC=/var/lib/jenkins/pylint.wcs.rc
elif [ -f pylint.wcs.rc ]; then
PYLINT_RC=pylint.wcs.rc
else
echo No pylint RC found
exit 0
fi
test -f pylint.out && cp pylint.out pylint.out.prev
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true

39
tox.ini
View File

@ -1,37 +1,34 @@
[tox] [tox]
envlist = coverage-{django18,django111}-pylint-pg toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/wcs/{env:BRANCH_NAME:}
skipsdist = True envlist = py2-pylint-coverage
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/wcs/
[testenv] [testenv]
sitepackages = true
setenv = setenv =
PYTHONPATH=. PYTHONPATH={toxinidir}{:}{env:PYTHONPATH:}
PYTHONHASHSEED=0
DJANGO_SETTINGS_MODULE=wcs.settings DJANGO_SETTINGS_MODULE=wcs.settings
WCS_SETTINGS_FILE=tests/settings.py WCS_SETTINGS_FILE=tests/settings.py
coverage: COVERAGE=--junit-xml=test_results.xml --cov=wcs --cov-report xml --cov-config .coveragerc LC_ALL=C
LC_TIME=C
LANG=C
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov-report html --cov=wcs/ --cov-config .coveragerc -v
passenv = passenv =
USER USER
deps = deps =
django18: django>=1.8,<1.9 pytest
django111: django>=1.11,<1.12
pytest>=3.3.0,<4.1
pytest-mock pytest-mock
pytest-cov pytest-cov
pytest-django
WebTest WebTest
psycopg2
mechanize mechanize
gadjo>=0.53 gadjo
requests
scgi
vobject
pyquery pyquery
http://quixote.python.ca/releases/Quixote-2.7b2.tar.gz git+https://git.entrouvert.org/debian/django-ckeditor.git
qrcode django >=1.11, <1.12
python-dateutil django-ratelimit<3
pillow
feedparser
pyproj pyproj
pylint<1.8
commands = commands =
./getlasso.sh py.test {env:COVERAGE:} {posargs:tests/}
pickle: py.test --without-postgresql-tests {env:COVERAGE:} {posargs:tests} pylint: ./pylint.sh wcs/
pg: py.test {env:COVERAGE:} {posargs:tests}