Skip to content

Commit

Permalink
Run tox tests in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 committed Apr 29, 2023
1 parent 03bd22f commit 84865d1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions changes/1247.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python tests are now run in parallel via ``tox``.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ requires = ["setuptools>=60", "setuptools_scm[toml]>=7.0"]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
concurrency = ["multiprocessing", "thread"]
parallel = true
sigterm = true
branch = true
relative_files = true
source_pkgs = ["briefcase"]
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ install_requires =
# ensure environment consistency.
dev =
coverage[toml] == 7.2.3
coverage-enable-subprocess == 1.0
pre-commit == 3.2.2
pytest == 7.3.1
pytest-xdist == 3.2.1
setuptools_scm[toml] == 7.1.0
tox == 4.4.12
docs =
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def no_print(monkeypatch):

@pytest.fixture
def sleep_zero(monkeypatch):
"""Replace all calls to ``time.sleep(x)`` with ``time.sleep(0)."""
"""Replace all calls to ``time.sleep(x)`` with ``time.sleep(0)``."""
monkeypatch.setattr(time, "sleep", lambda x: _sleep(0))


Expand Down
7 changes: 5 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ download = True
# The leading comma generates the "py" environment.
[testenv:py{,38,39,310,311,312}{,-coverage}]
passenv =
# LOCALAPPDATA is needed to test data directory creation on Windows.
# Needed on Windows to test data directory creation
LOCALAPPDATA
setenv =
# Start Python such that coverage is possible in subprocesses
COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml
extras =
dev
# 2023-04-22 The virtualenv used by Tox has pip 23.1 pinned into it
# This version has a bug on winstore installs of Python, so we
# need to force pip to be updated.
download = True
commands =
python -m coverage run -m pytest -vv {posargs}
python -m coverage run -m pytest {posargs:-n auto -vv}
coverage : python -m coverage combine
coverage : python -m coverage report

Expand Down

0 comments on commit 84865d1

Please sign in to comment.