ci: speed up CI using multiple processes with pytest (#67088)

This commit is contained in:
Agate 2022-07-06 17:02:23 +02:00
parent 6e5eef1764
commit 346000f67f
3 changed files with 6 additions and 3 deletions

2
Jenkinsfile vendored
View File

@ -9,7 +9,7 @@ pipeline {
stages { stages {
stage('Unit Tests') { stage('Unit Tests') {
steps { steps {
sh 'tox -rv' sh 'NUMPROCESSES=6 tox -rv'
} }
post { post {
always { always {

View File

@ -2,4 +2,4 @@
set -e -x set -e -x
env env
pylint -f parseable --rcfile pylint.rc "$@" | tee pylint.out; test $PIPESTATUS -eq 0 pylint --jobs ${NUMPROCESSES:-1} -f parseable --rcfile pylint.rc "$@" | tee pylint.out; test $PIPESTATUS -eq 0

View File

@ -9,6 +9,7 @@ setenv =
COMBO_SETTINGS_FILE=tests/settings.py COMBO_SETTINGS_FILE=tests/settings.py
TOX_WORK_DIR={toxworkdir} TOX_WORK_DIR={toxworkdir}
SETUPTOOLS_USE_DISTUTILS=stdlib SETUPTOOLS_USE_DISTUTILS=stdlib
NUMPROCESSES={env:NUMPROCESSES:1}
coverage: COVERAGE=--cov-report xml --cov-report html --cov=combo/ --cov-config .coveragerc -v coverage: COVERAGE=--cov-report xml --cov-report html --cov=combo/ --cov-config .coveragerc -v
DB_ENGINE=django.db.backends.postgresql_psycopg2 DB_ENGINE=django.db.backends.postgresql_psycopg2
passenv = passenv =
@ -19,6 +20,7 @@ deps =
pytest-cov pytest-cov
pytest-django pytest-django
pytest-freezegun pytest-freezegun
pytest-xdist
pytest!=5.3.3 pytest!=5.3.3
WebTest WebTest
mock<4 mock<4
@ -38,7 +40,7 @@ deps =
commands = commands =
./getlasso3.sh ./getlasso3.sh
python manage.py compilemessages python manage.py compilemessages
py.test {env:COVERAGE:} {posargs: --junitxml=junit-{envname}.xml tests/} py.test {env:COVERAGE:} {posargs: --numprocesses {env:NUMPROCESSES:1} --junitxml=junit-{envname}.xml tests/}
codestyle: pre-commit run --all-files --show-diff-on-failure codestyle: pre-commit run --all-files --show-diff-on-failure
[testenv:pylint] [testenv:pylint]
@ -48,6 +50,7 @@ setenv =
TOX_WORK_DIR={toxworkdir} TOX_WORK_DIR={toxworkdir}
SETUPTOOLS_USE_DISTUTILS=stdlib SETUPTOOLS_USE_DISTUTILS=stdlib
DB_ENGINE=django.db.backends.postgresql_psycopg2 DB_ENGINE=django.db.backends.postgresql_psycopg2
NUMPROCESSES={env:NUMPROCESSES:1}
deps = deps =
pytest-django pytest-django
pytest-freezegun pytest-freezegun