From 4fc1354aeb6b217cd18dbdb2a0c41373fa9d8056 Mon Sep 17 00:00:00 2001 From: Richard Si <63936253+ichard26@users.noreply.github.com> Date: Fri, 7 May 2021 10:41:55 -0400 Subject: [PATCH] Speed up test suite via distributed testing (#2196) * Speed up test suite via distributed testing Since we now run the test suite twice, one with Python 2 and another without, full test runs are getting pretty slow. Let's try to fix that with parallization. Also use verbose mode on CI since more logs is usually better since getting more is quite literally impossible. The main issue we'll face with this is we'll hit https://github.com/pytest-dev/pytest-xdist/issues/620 sometimes (although pretty rarely). I suppose we can test this and see if how bad this bug is for us, and revert if necessary down the line. Also let's have some colours :tada: --- .coveragerc | 1 + .github/workflows/test.yml | 2 +- test_requirements.txt | 2 ++ tox.ini | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.coveragerc b/.coveragerc index f05041c..5577e49 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,6 +3,7 @@ omit = src/blib2to3/* tests/data/* */site-packages/* + .tox/* [run] relative_files = True diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03adc7f..2cfbab6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: - name: Unit tests run: | - tox -e py + tox -e py -- -v --color=yes - name: Publish coverage to Coveralls # If pushed / is a pull request against main repo AND diff --git a/test_requirements.txt b/test_requirements.txt index a1464e9..31ab2d0 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -3,5 +3,7 @@ pre-commit pytest >= 6.1.1 pytest-mock >= 3.3.1 pytest-cases >= 2.3.0 +pytest-xdist >= 2.2.1 +pytest-cov >= 2.11.1 parameterized >= 0.7.4 tox diff --git a/tox.ini b/tox.ini index 317bf48..2379500 100644 --- a/tox.ini +++ b/tox.ini @@ -9,9 +9,9 @@ deps = commands = pip install -e .[d] coverage erase - coverage run -m pytest tests --run-optional=no_python2 {posargs} + pytest tests --run-optional no_python2 --numprocesses auto --cov {posargs} pip install -e .[d,python2] - coverage run -m pytest tests --run-optional=python2 {posargs} + pytest tests --run-optional python2 --numprocesses auto --cov --cov-append {posargs} coverage report [testenv:fuzz] -- 2.39.5