Projet

Général

Profil

0004-jenkins-switch-to-tox-for-running-tests-15974.patch

Frédéric Péters, 24 avril 2017 14:06

Télécharger (2,83 ko)

Voir les différences:

Subject: [PATCH 4/4] jenkins: switch to tox for running tests (#15974)

 jenkins.sh | 16 +++-------------
 pylint.sh  | 16 ++++++++++++++++
 tox.ini    | 30 ++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 13 deletions(-)
 create mode 100755 pylint.sh
 create mode 100644 tox.ini
jenkins.sh
2 2

  
3 3
set -e
4 4

  
5
rm -f pylint.out
5 6
rm -f coverage.xml
6 7
rm -f test_results.xml
7 8

  
8
export PIP_USE_WHEEL=no
9
pip install --upgrade 'pip<8'
10
pip install --upgrade pylint pylint-django
11
pip install --upgrade pytest pytest-django pytest-cov WebTest django-webtest 'setuptools<34'
12
pip install --upgrade -r requirements.txt
13
pip install --upgrade django-mellon 'django<1.9'
14

  
15
PYTHONPATH=$(pwd):$PYTHONPATH DJANGO_SETTINGS_MODULE=chrono.settings CHRONO_SETTINGS_FILE=tests/settings.py \
16
	py.test --junitxml=test_results.xml --cov-report xml --cov=chrono/ --cov-config .coveragerc tests/
17

  
18
test -f pylint.out && cp pylint.out pylint.out.prev
19
(pylint -f parseable --rcfile /var/lib/jenkins/pylint.django.rc chrono | tee pylint.out) || /bin/true
20
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true
9
pip install --upgrade tox
10
tox -rv
pylint.sh
1
#!/bin/sh
2

  
3
set -e -x
4
env
5
if [ -f /var/lib/jenkins/pylint.django.rc ]; then
6
	PYLINT_RC=/var/lib/jenkins/pylint.django.rc
7
elif [ -f pylint.django.rc ]; then
8
	PYLINT_RC=pylint.django.rc
9
else
10
	echo No pylint RC found
11
	exit 0
12
fi
13

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

  
5
[testenv]
6
usedevelop =
7
  coverage: True
8
  nocoverage: False
9
setenv =
10
  DJANGO_SETTINGS_MODULE=chrono.settings
11
  CHRONO_SETTINGS_FILE=tests/settings.py
12
  coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=chrono/
13
deps =
14
  django18: django>=1.8,<1.9
15
  django111: django>=1.11,<1.12
16
  pytest-cov
17
  pytest-django
18
  pytest
19
  pytest-capturelog
20
  WebTest
21
  mock
22
  httmock
23
  pylint
24
  pylint-django
25
  django-webtest
26
  django-mellon
27
commands =
28
  ./getlasso.sh
29
  py.test {env:COVERAGE:} {posargs:tests/}
30
  pylint: ./pylint.sh chrono/
0
-