From 821273fb0c0e9953874822c09701f06402adfd89 Mon Sep 17 00:00:00 2001 From: Louis Sautier Date: Fri, 13 Nov 2020 23:45:54 +0100 Subject: [PATCH] Run tests in parallel with pytest-xdist Also stop running tox in parallel when not required because it buffers output, making it harder to see what is happening. Output could be shown unbuffered with --parallel-live but it isn't really helpful for what we're trying to achieve. --- .travis.yml | 38 +++++++++++++++++++++++--------------- appveyor.yml | 2 +- tox.ini | 3 ++- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index a11dab3..863aac9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,38 +8,45 @@ addons: jobs: include: - python: &python_main_version 3.8 - env: TOXENV=docs,black,flake8,isort,mypy,pylint + env: + TOXENV: docs,black,flake8,isort,mypy,pylint + TOX_PARALLEL: "-p" - python: 3.6 - env: TOXENV=py36 + env: + TOXENV: py36 - python: 3.7 - env: TOXENV=py37 + env: + TOXENV: py37 - python: 3.8 - env: TOXENV=py38 + env: + TOXENV: py38 - python: 3.9 - env: TOXENV=py39 + env: + TOXENV: py39 - python: pypy3 - env: TOXENV=pypy3 + env: + TOXENV: pypy3 - os: osx # Not required but makes Travis' output prettier language: generic env: - - MB_PYTHON_VERSION=3.6 - - TOXENV=py36 + MB_PYTHON_VERSION: 3.6 + TOXENV: py36 - os: osx language: generic env: - - MB_PYTHON_VERSION=3.7 - - TOXENV=py37 + MB_PYTHON_VERSION: 3.7 + TOXENV: py37 - os: osx language: generic env: - - MB_PYTHON_VERSION=3.8 - - TOXENV=py38 + MB_PYTHON_VERSION: 3.8 + TOXENV: py38 - os: osx language: generic env: - - MB_PYTHON_VERSION=3.9 - - TOXENV=py39 + MB_PYTHON_VERSION: 3.9 + TOXENV: py39 before_install: | if [ $TRAVIS_OS_NAME == osx ]; then git clone https://github.com/matthew-brett/multibuild @@ -62,7 +69,7 @@ before_install: | popd fi pip install tox -script: tox -p +script: "tox $TOX_PARALLEL" notifications: email: on_success: change @@ -89,3 +96,4 @@ env: - LIBZEN_VERSION: 0.4.38 - UBUNTU_VERSION: 18.04 - PYTHON_MAIN_VERSION: *python_main_version + - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/appveyor.yml b/appveyor.yml index 5fcd54a..9a24050 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,7 +35,7 @@ install: - "move MediaInfo.dll pymediainfo" - "move Developers\\License.html docs" # TODO: remove the constraint when https://github.com/tox-dev/tox/issues/1550 is fixed - - "pip install --upgrade setuptools pytest tox==3.8.3 twine wheel" + - "pip install --upgrade setuptools tox==3.8.3 twine wheel" build_script: - "python setup.py bdist_wheel" test_script: diff --git a/tox.ini b/tox.ini index 721eb08..e936f50 100644 --- a/tox.ini +++ b/tox.ini @@ -14,9 +14,10 @@ envlist = [testenv] deps = pytest + pytest-xdist setuptools_scm commands = - pytest {posargs} + pytest -n auto {posargs} [testenv:docs] deps = sphinx