Projet

Général

Profil

0002-use-tox-to-run-tests-15562.patch

Emmanuel Cazenave, 26 septembre 2019 15:50

Télécharger (3,2 ko)

Voir les différences:

Subject: [PATCH 2/2] use tox to run tests (#15562)

 .coveragerc |  5 +++++
 Jenkinsfile |  2 +-
 pylint.sh   | 15 +++++++++++++++
 tox.ini     | 39 ++++++++++++++++++---------------------
 4 files changed, 39 insertions(+), 22 deletions(-)
 create mode 100644 .coveragerc
 create mode 100755 pylint.sh
.coveragerc
1
[run]
2
omit = wcs/ctl/Bouncers/*.py wcs/qommon/vendor/*.py
3

  
4
[report]
5
omit = wcs/ctl/Bouncers/*.py wcs/qommon/vendor/*.py
Jenkinsfile
6 6
    stages {
7 7
        stage('Unit Tests') {
8 8
            steps {
9
                sh './jenkins.sh'
9
                sh 'tox -r'
10 10
            }
11 11
            post {
12 12
                always {
pylint.sh
1
#!/bin/sh
2
set -e -x
3
env
4
if [ -f /var/lib/jenkins/pylint.wcs.rc ]; then
5
	PYLINT_RC=/var/lib/jenkins/pylint.wcs.rc
6
elif [ -f pylint.wcs.rc ]; then
7
	PYLINT_RC=pylint.wcs.rc
8
else
9
	echo No pylint RC found
10
	exit 0
11
fi
12

  
13
test -f pylint.out && cp pylint.out pylint.out.prev
14
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true
15
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true
tox.ini
1 1
[tox]
2
envlist = coverage-{django18,django111}-pylint-pg
3
skipsdist = True
4
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/wcs/
2
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/wcs/{env:BRANCH_NAME:}
3
envlist = py2-pylint-coverage
5 4

  
6 5
[testenv]
6
sitepackages = true
7 7
setenv =
8
    PYTHONPATH=.
8
    PYTHONPATH={toxinidir}{:}{env:PYTHONPATH:}
9
    PYTHONHASHSEED=0
9 10
    DJANGO_SETTINGS_MODULE=wcs.settings
10 11
    WCS_SETTINGS_FILE=tests/settings.py
11
    coverage: COVERAGE=--junit-xml=test_results.xml --cov=wcs --cov-report xml --cov-config .coveragerc
12
    LC_ALL=C
13
    LC_TIME=C
14
    LANG=C
15
    coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov-report html --cov=wcs/ --cov-config .coveragerc -v
12 16
passenv =
13 17
    USER
14 18
deps =
15
    django18: django>=1.8,<1.9
16
    django111: django>=1.11,<1.12
17
    pytest>=3.3.0,<4.1
19
    pytest<4.1
18 20
    pytest-mock
19 21
    pytest-cov
22
    pytest-django
20 23
    WebTest
21
    psycopg2
22 24
    mechanize
23
    gadjo>=0.53
24
    requests
25
    scgi
26
    vobject
25
    gadjo
27 26
    pyquery
28
    http://quixote.python.ca/releases/Quixote-2.7b2.tar.gz
29
    qrcode
30
    python-dateutil
31
    pillow
32
    feedparser
27
    git+https://git.entrouvert.org/debian/django-ckeditor.git
28
    django >=1.11, <1.12
29
    django-ratelimit<3
33 30
    pyproj
31
    pylint<1.8
34 32
commands =
35
    ./getlasso.sh
36
    pickle:  py.test --without-postgresql-tests {env:COVERAGE:} {posargs:tests}
37
    pg:  py.test {env:COVERAGE:} {posargs:tests}
33
    py.test {env:COVERAGE:} {posargs:tests/}
34
    pylint: ./pylint.sh wcs/
38
-