misc: use tox to run tests in jenkins (#10284)
This commit is contained in:
parent
aff45d1a0e
commit
b0bea13bc9
23
jenkins.sh
23
jenkins.sh
|
@ -2,29 +2,12 @@
|
|||
|
||||
set -e
|
||||
|
||||
rm -f pylint.out
|
||||
rm -f coverage.xml
|
||||
rm -f test_results.xml
|
||||
|
||||
test -d wcs || git clone http://git.entrouvert.org/wcs.git
|
||||
(cd wcs && git pull)
|
||||
|
||||
export PIP_USE_WHEEL=no
|
||||
(pip freeze | grep -q Quixote) || pip install quixote
|
||||
(pip freeze | grep -q scgi) || pip install scgi
|
||||
pip install --upgrade 'pip<8'
|
||||
pip install --upgrade 'pylint<1.8' pylint-django
|
||||
pip install --upgrade -r requirements.txt
|
||||
pip install --upgrade pytest pytest-django pytest-cov WebTest django-webtest 'setuptools<34'
|
||||
pip install --upgrade 'django>=1.8, <1.9'
|
||||
pip install --no-deps --upgrade 'git+http://repos.entrouvert.org/cmsplugin-blurp.git/#egg=django-cmsplugin-blurp' # use blurp from git/master for now
|
||||
pip install --upgrade XStatic-ChartNew.js
|
||||
pip install --upgrade mock
|
||||
|
||||
WCSCTL=$(pwd)/wcs/wcsctl.py \
|
||||
DJANGO_SETTINGS_MODULE=combo.settings \
|
||||
COMBO_SETTINGS_FILE=tests/settings.py \
|
||||
py.test --junitxml=test_results.xml --cov-report xml --cov=combo/ --cov-config .coveragerc tests/
|
||||
|
||||
test -f pylint.out && cp pylint.out pylint.out.prev
|
||||
(pylint -f parseable --rcfile /var/lib/jenkins/pylint.django.rc combo | tee pylint.out) || /bin/true
|
||||
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true
|
||||
pip install --upgrade tox
|
||||
tox -rv
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
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
|
||||
PYLINT_RC=pylint.django.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
|
2
setup.py
2
setup.py
|
@ -103,7 +103,7 @@ setup(
|
|||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
],
|
||||
install_requires=['django>=1.8, <1.9',
|
||||
install_requires=['django>=1.8, <1.12',
|
||||
'django-ckeditor<4.5.3',
|
||||
'gadjo',
|
||||
'feedparser',
|
||||
|
|
|
@ -26,7 +26,6 @@ wcsctl_present = pytest.mark.skipif('WCSCTL' not in os.environ,
|
|||
reason='WCSCTL not defined in environment')
|
||||
|
||||
WCSCTL = os.environ.get('WCSCTL')
|
||||
WCS_MANAGE = os.path.join(os.path.dirname(WCSCTL), 'manage.py') if WCSCTL else None
|
||||
|
||||
WCS_SCRIPTS = {
|
||||
'setup-auth': """
|
||||
|
@ -183,10 +182,10 @@ ALLOWED_HOSTS = ['127.0.0.1', '127.0.0.2']
|
|||
|
||||
WCS_PID = os.fork()
|
||||
if not WCS_PID:
|
||||
os.chdir(os.path.dirname(WCS_MANAGE))
|
||||
os.chdir(os.path.dirname(WCSCTL))
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'wcs.settings'
|
||||
os.environ['WCS_SETTINGS_FILE'] = os.path.join(WCS_DIR, 'local_settings.py')
|
||||
os.execvp('python', ['python', WCS_MANAGE, 'runserver', '--noreload', '0.0.0.0:8999'])
|
||||
os.execvp('python', ['python', 'manage.py', 'runserver', '--noreload', '0.0.0.0:8999'])
|
||||
sys.exit(0)
|
||||
|
||||
time.sleep(5)
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
[tox]
|
||||
envlist = coverage-{django18,django111}-pylint
|
||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo/
|
||||
|
||||
[testenv]
|
||||
usedevelop =
|
||||
coverage: True
|
||||
nocoverage: False
|
||||
setenv =
|
||||
WCSCTL=wcs/wcsctl.py
|
||||
DJANGO_SETTINGS_MODULE=combo.settings
|
||||
COMBO_SETTINGS_FILE=tests/settings.py
|
||||
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=combo/
|
||||
deps =
|
||||
django18: django>=1.8,<1.9
|
||||
django111: django>=1.11,<1.12
|
||||
pytest-cov
|
||||
pytest-django
|
||||
pytest
|
||||
pytest-capturelog
|
||||
WebTest
|
||||
mock
|
||||
httmock
|
||||
pylint<1.8
|
||||
pylint-django
|
||||
django-webtest
|
||||
quixote
|
||||
vobject
|
||||
commands =
|
||||
py.test {env:COVERAGE:} {posargs:tests/}
|
||||
pylint: ./pylint.sh combo/
|
Loading…
Reference in New Issue