Skip to content

Commit f262cfe

Browse files
committed
Quit (timeout) Python test suite on suspected deadlock
1 parent bd539d0 commit f262cfe

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

justfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ test-unit *TEST_ARGS:
4040
cargo nextest run {{TEST_ARGS}}
4141

4242
# Python integration test suite. Args are forwarded to pytest
43+
# We run the command with 'timeout 10' to kill pytest if a deadlock were to happen
4344
[group('test')]
4445
test-integration *TEST_ARGS: build-bin build-python
4546
#!/usr/bin/env bash
4647
set -euxo pipefail
4748
cd libs/opsqueue_python
4849
source "./.setup_local_venv.sh"
4950

50-
pytest --color=yes {{TEST_ARGS}}
51+
timeout 30 pytest --color=yes {{TEST_ARGS}}
5152

5253
# Python integration test suite, using artefacts built through Nix. Args are forwarded to pytest
5354
[group('nix')]

libs/opsqueue_python/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ test = [
5252
"pytest==8.3.3",
5353
"pytest-random-order==1.1.1",
5454
"pytest-parallel==0.1.1",
55+
"pytest-timeout==2.4.0",
5556
"py==1.11.0", # Needs to be manually specified because of this issue: https://github.com/kevlened/pytest-parallel/issues/118
5657
]
5758

5859
[tool.pytest.ini_options]
5960
# We ensure tests never rely on global state,
6061
# by running them in a random order, and in parallel:
6162
addopts = "--random-order --workers=auto"
63+
# Individual tests should be very fast. If they take longer, this indicates a deadlock
64+
timeout=20

0 commit comments

Comments
 (0)