From 20254f7434d6821329646683ead7772f024b272e Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 25 Jun 2022 13:12:52 -0700 Subject: [PATCH] Run tests in parallel (#1519) * Clean up pyproject file This reduces the differences between local tasks and tasks run in the CI pipelines * remove linting step (it's part of test now) * remove useless arg * add xdist for parallel test execution in pytest --- poetry.lock | 58 ++++++++++++++++++++++++++++++++++++++++++++++---- pyproject.toml | 3 +++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index e18a0197..7cfac23b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -170,6 +170,17 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "execnet" +version = "1.9.0" +description = "execnet: rapid multi-Python deployment" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[package.extras] +testing = ["pre-commit"] + [[package]] name = "executing" version = "0.8.3" @@ -732,6 +743,36 @@ pprintpp = ">=0.4.0" pytest = ">=3.5.0" rich = ">=8.0.0" +[[package]] +name = "pytest-forked" +version = "1.4.0" +description = "run tests in isolated forked subprocesses" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +py = "*" +pytest = ">=3.10" + +[[package]] +name = "pytest-xdist" +version = "2.5.0" +description = "pytest xdist plugin for distributed testing and loop-on-failing modes" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +execnet = ">=1.1" +pytest = ">=6.2.0" +pytest-forked = "*" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + [[package]] name = "python-dateutil" version = "2.8.2" @@ -1010,13 +1051,10 @@ python-versions = ">=3.7" docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)"] testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"] -[extras] -testing = [] - [metadata] lock-version = "1.1" python-versions = ">=3.9.0, <3.12" -content-hash = "ceca9186ac31a0b8ec81a6cc134469842080c786971bb8642d9e67d51bd73fca" +content-hash = "8f6875939de19061a92093ce15d9566f5e038f899effd64db5bc8590024129fa" [metadata.files] ansiwrap = [ @@ -1168,6 +1206,10 @@ distlib = [ {file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"}, {file = "distlib-0.3.4.zip", hash = "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"}, ] +execnet = [ + {file = "execnet-1.9.0-py2.py3-none-any.whl", hash = "sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142"}, + {file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"}, +] executing = [ {file = "executing-0.8.3-py2.py3-none-any.whl", hash = "sha256:d1eef132db1b83649a3905ca6dd8897f71ac6f8cac79a7e58a1a09cf137546c9"}, {file = "executing-0.8.3.tar.gz", hash = "sha256:c6554e21c6b060590a6d3be4b82fb78f8f0194d809de5ea7df1c093763311501"}, @@ -1390,6 +1432,14 @@ pytest-bdd = [ pytest-clarity = [ {file = "pytest-clarity-1.0.1.tar.gz", hash = "sha256:505fe345fad4fe11c6a4187fe683f2c7c52c077caa1e135f3e483fe112db7772"}, ] +pytest-forked = [ + {file = "pytest-forked-1.4.0.tar.gz", hash = "sha256:8b67587c8f98cbbadfdd804539ed5455b6ed03802203485dd2f53c1422d7440e"}, + {file = "pytest_forked-1.4.0-py3-none-any.whl", hash = "sha256:bbbb6717efc886b9d64537b41fb1497cfaf3c9601276be8da2cccfea5a3c8ad8"}, +] +pytest-xdist = [ + {file = "pytest-xdist-2.5.0.tar.gz", hash = "sha256:4580deca3ff04ddb2ac53eba39d76cb5dd5edeac050cb6fbc768b0dd712b4edf"}, + {file = "pytest_xdist-2.5.0-py3-none-any.whl", hash = "sha256:6fe5c74fec98906deb8f2d2b616b5c782022744978e7bd4695d39c8f42d0ce65"}, +] python-dateutil = [ {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, diff --git a/pyproject.toml b/pyproject.toml index 175dfa00..73569ff3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ pyproject-flake8 = "*" pytest = ">=6.2" pytest-bdd = ">=4.0.1" pytest-clarity = "*" +pytest-xdist = ">=2.5.0" toml = ">=0.10" tox = "*" yq = "*" @@ -119,6 +120,7 @@ addopts = [ "--pdbcls=IPython.terminal.debugger:Pdb", "--gherkin-terminal-reporter", "--tb=native", + "-n=auto", ] filterwarnings = [ @@ -147,6 +149,7 @@ isolated_build = True deps = pytest >= 6.2 pytest-bdd >=4.0.1 + pytest-xdist >=2.5.0 toml >=0.10 commands = pytest {posargs}