Add conftest.py to increase timeouts for slow tests#894
Conversation
|
Ran tests without a pre-existing detector database, and each one takes <= 67s on my machine. |
|
tqec/tqecd#45 is expected to be merged soon, so we may not even need to have the slow marker. Will take a look then. |
I like it, but, the full test suite is actually broken atm due to the timeouts not accommodating the slow tests. |
|
Hi all — sharing an AI-assisted code review of this PR. Generated by github-agent and then human-curated against pytest / pytest-timeout source before posting. The raw output, the prompt fixes that took it from "factually wrong" to "useful," and the curation workflow are all in Verdict: NEEDS_DISCUSSION — not blocking. The diff is minimal and faithful to the issue. One subtle behavioural footgun seemed worth flagging before merge. The footgunWhen a slow test also carries an explicit
Why (with citations)
Runtime-verified on pytest 8.3.5 + pytest-timeout 2.4.0; reproducible 4-file project here. Suggested fixdef pytest_collection_modifyitems(items):
"""Increase timeouts for tests marked as slow, unless the test has its
own explicit timeout marker (which we leave alone)."""
for item in items:
if item.get_closest_marker("slow") and not item.get_closest_marker("timeout"):
item.add_marker(pytest.mark.timeout(SLOW_TEST_TIMEOUT))Mechanically equivalent to today's behaviour (the explicit decorator would win anyway), but makes the precedence visible at the call site and doesn't depend on pytest-timeout's marker-resolution rules. Minor: coupling worth a commentThe diff increases timeouts for Genuinely interested in whether the multi-marker case maps to anything that actually happens in tqec's test suite — if no slow tests carry their own |
By default tests have a 30-second timeout, which is more than enough time for the non-slow tests run in our pipeline.
Use
conftestto set a higher timeout for the slow tests, which are run withpytest -m "slow".