Product impact
Describe the bug
backend/tests/unit/test_workflow_contracts.py::test_workflow_contract_sources_select_adjacent_tests repeatedly exceeds the local 0.12-second fast-unit CPU budget on Windows even though every assertion passes.
To reproduce
- On Windows, select
tests/unit/test_workflow_contracts.py through backend/test.sh with the default local duration guard.
- Observe all 19 tests pass.
- Observe the session still exits 1 because
test_workflow_contract_sources_select_adjacent_tests measures approximately 0.12-0.14 seconds of call-phase CPU.
Current behavior
The workflow-contract test file loads select_backend_unit_tests.py and scans the full discovered test inventory independently in seven test calls. The slow test then evaluates 19 source-path cases on top of that repeated setup. Windows filesystem/path processing pushes the call just over the strict local threshold, blocking unrelated pre-push runs.
Expected behavior
Shared selector loading and test discovery should run once as module-scoped test setup. Individual contract assertions should remain under the existing strict budget without adding a global allowlist exception or raising the threshold.
Environment
- Windows 11
- Python 3.11.15
- pytest 8.4.1
Additional context
The duration guard intentionally measures only the call phase so shared setup is not misattributed as a per-test regression. Reusing a module-scoped fixture follows that contract and also reduces total file runtime.
Product impact
Describe the bug
backend/tests/unit/test_workflow_contracts.py::test_workflow_contract_sources_select_adjacent_testsrepeatedly exceeds the local 0.12-second fast-unit CPU budget on Windows even though every assertion passes.To reproduce
tests/unit/test_workflow_contracts.pythroughbackend/test.shwith the default local duration guard.test_workflow_contract_sources_select_adjacent_testsmeasures approximately 0.12-0.14 seconds of call-phase CPU.Current behavior
The workflow-contract test file loads
select_backend_unit_tests.pyand scans the full discovered test inventory independently in seven test calls. The slow test then evaluates 19 source-path cases on top of that repeated setup. Windows filesystem/path processing pushes the call just over the strict local threshold, blocking unrelated pre-push runs.Expected behavior
Shared selector loading and test discovery should run once as module-scoped test setup. Individual contract assertions should remain under the existing strict budget without adding a global allowlist exception or raising the threshold.
Environment
Additional context
The duration guard intentionally measures only the call phase so shared setup is not misattributed as a per-test regression. Reusing a module-scoped fixture follows that contract and also reduces total file runtime.