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 {
stage('Unit Tests') {
steps {
sh './jenkins.sh'
sh 'tox -r'
}
post {
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]
envlist = coverage-{django18,django111}-pylint-pg
skipsdist = True
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/wcs/
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/wcs/{env:BRANCH_NAME:}
envlist = py2-pylint-coverage
[testenv]
sitepackages = true
setenv =
PYTHONPATH=.
PYTHONPATH={toxinidir}{:}{env:PYTHONPATH:}
PYTHONHASHSEED=0
DJANGO_SETTINGS_MODULE=wcs.settings
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 =
USER
deps =
django18: django>=1.8,<1.9
django111: django>=1.11,<1.12
pytest>=3.3.0,<4.1
pytest
pytest-mock
pytest-cov
pytest-django
WebTest
psycopg2
mechanize
gadjo>=0.53
requests
scgi
vobject
gadjo
pyquery
http://quixote.python.ca/releases/Quixote-2.7b2.tar.gz
qrcode
python-dateutil
pillow
feedparser
git+https://git.entrouvert.org/debian/django-ckeditor.git
django >=1.11, <1.12
django-ratelimit<3
pyproj
pylint<1.8
commands =
./getlasso.sh
pickle: py.test --without-postgresql-tests {env:COVERAGE:} {posargs:tests}
pg: py.test {env:COVERAGE:} {posargs:tests}
py.test {env:COVERAGE:} {posargs:tests/}
pylint: ./pylint.sh wcs/