Skip to content

💫 Toolkit to help you get started with SDD or any other process!

ci: shorten test runs with two workers and faster fixture shutdown (#5051)

Ken Schlobohmbe7bcf6494ed
diff --git a/.github/security-audit-requirements.txt b/.github/security-audit-requirements.txt
index d54292448..b5feaee1a 100644
--- a/.github/security-audit-requirements.txt
+++ b/.github/security-audit-requirements.txt
@@ -318,6 +318,10 @@ cryptography==50.0.2 \
--hash=sha256:fa8f5efb344d6908a1ce62f4a24e2e5780f825d6f53f5f50ec5ffacac72936cb \
--hash=sha256:fdd28f912fccfec1846a94e2e1e8f9b0012f557f0c46fe4f3eb0d7a87afcf90b
# via pyjwt
+execnet==2.1.2 \
+ --hash=sha256:63d83bfdd9a23e35b9c6a3261412324f964c2ec8dcd8d3c6916ee9373e0befcd \
+ --hash=sha256:67fba928dd5a544b783f6056f449e5e3931a5c378b128bc18501f7ea79e296ec
+ # via pytest-xdist
h11==0.16.0 ; sys_platform != 'emscripten' \
--hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \
--hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86
@@ -543,10 +547,15 @@ pytest==9.1.1 \
# via
# specify-cli (pyproject.toml)
# pytest-cov
+ # pytest-xdist
pytest-cov==7.1.0 \
--hash=sha256:30674f2b5f6351aa09702a9c8c364f6a01c27aae0c1366ae8016160d1efc56b2 \
--hash=sha256:a0461110b7865f9a271aa1b51e516c9a95de9d696734a2f71e3e78f46e1d4678
# via specify-cli (pyproject.toml)
+pytest-xdist==3.8.0 \
+ --hash=sha256:202ca578cfeb7370784a8c33d6d05bc6e13b4f25b5053c30a152269fd10f0b88 \
+ --hash=sha256:7e578125ec9bc6050861aa93f2d59f1d8d085595d6551c2c90b6f4fad8d3a9f1
+ # via specify-cli (pyproject.toml)
python-multipart==0.0.32 \
--hash=sha256:be54b7f3fa167bb83e4fcd936b887b708f4e57fe75911c02aebf53efaf8d938e \
--hash=sha256:ff6d3f776f16878c894e52e107296ffc890e913c611b1a4ec6c44e2821fe2e23
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index dceb97c6e..578fb5ade 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -52,4 +52,4 @@ jobs:
# because it cannot handle native Windows paths in test fixtures.
# See tests/conftest.py::_has_working_bash() for details.
- name: Run tests
- run: uv run pytest
+ run: uv run pytest -n 2
diff --git a/pyproject.toml b/pyproject.toml
index ccc0d97aa..7cdecced2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -62,6 +62,7 @@ packages = ["src/specify_cli"]
test = [
"pytest>=7.0",
"pytest-cov>=4.0",
+ "pytest-xdist>=3.0",
]
[tool.pytest.ini_options]
diff --git a/tests/specify_cli/integrations/test_installed_adapters.py b/tests/specify_cli/integrations/test_installed_adapters.py
index 0c1bb0a60..fe74ec82e 100644
--- a/tests/specify_cli/integrations/test_installed_adapters.py
+++ b/tests/specify_cli/integrations/test_installed_adapters.py
@@ -104,7 +104,7 @@ def server(tmp_path):
pass
http = ThreadingHTTPServer(("127.0.0.1", 0), partial(Handler, directory=str(downloads)))
- thread = threading.Thread(target=http.serve_forever, daemon=True)
+ thread = threading.Thread(target=http.serve_forever, kwargs={"poll_interval": 0.01}, daemon=True)
thread.start()
result = SimpleNamespace(
root=downloads, url=f"http://127.0.0.1:{http.server_port}", requests=requests,