From 346000f67f455a2eeb8fe164e1b06e6ae83c40ea Mon Sep 17 00:00:00 2001 From: Agate Date: Wed, 6 Jul 2022 17:02:23 +0200 Subject: [PATCH] ci: speed up CI using multiple processes with pytest (#67088) --- Jenkinsfile | 2 +- pylint.sh | 2 +- tox.ini | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 68453baf..0d26e62c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { stages { stage('Unit Tests') { steps { - sh 'tox -rv' + sh 'NUMPROCESSES=6 tox -rv' } post { always { diff --git a/pylint.sh b/pylint.sh index ba7a6c3a..b20598c1 100755 --- a/pylint.sh +++ b/pylint.sh @@ -2,4 +2,4 @@ set -e -x 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 \ No newline at end of file diff --git a/tox.ini b/tox.ini index 93719398..8574c326 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,7 @@ setenv = COMBO_SETTINGS_FILE=tests/settings.py TOX_WORK_DIR={toxworkdir} SETUPTOOLS_USE_DISTUTILS=stdlib + NUMPROCESSES={env:NUMPROCESSES:1} coverage: COVERAGE=--cov-report xml --cov-report html --cov=combo/ --cov-config .coveragerc -v DB_ENGINE=django.db.backends.postgresql_psycopg2 passenv = @@ -19,6 +20,7 @@ deps = pytest-cov pytest-django pytest-freezegun + pytest-xdist pytest!=5.3.3 WebTest mock<4 @@ -38,7 +40,7 @@ deps = commands = ./getlasso3.sh 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 [testenv:pylint] @@ -48,6 +50,7 @@ setenv = TOX_WORK_DIR={toxworkdir} SETUPTOOLS_USE_DISTUTILS=stdlib DB_ENGINE=django.db.backends.postgresql_psycopg2 + NUMPROCESSES={env:NUMPROCESSES:1} deps = pytest-django pytest-freezegun