Skip to content

fix(tests): refuse real sleeps in tests - #6317

Merged
dan-petty merged 1 commit into
mainfrom
fix/4669-refuse-real-sleeps-in-tests
Nov 18, 2026
Merged

dan-petty merged 1 commit into
mainfrom
fix/4669-refuse-real-sleeps-in-tests

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

No rule refused a real sleep in the test suite. An audit hook recorded 177 s of real sleep in 629 tests in 96 files in the probed test suite. direct time.sleep calls stayed across src, and tests waiting on rate limits or process loops slept for real. Each second of real sleep delays pull request checks and wastes continuous integration compute.

Closes #4669

Change: openspec/changes/archive/2026-11-18-4669-refuse-real-sleeps-in-tests/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/tests The test suite, its fixtures, fakes and floor labels Nov 18, 2026
@dan-petty
dan-petty force-pushed the fix/4669-refuse-real-sleeps-in-tests branch 4 times, most recently from 5ffb700 to d5c6c1c Compare November 18, 2026 18:18
No rule refused a real sleep in the test suite. An audit hook recorded
177 s of real sleep in 629 tests in 96 files. Direct calls stayed across
src, and tests waiting on rate limits or process loops slept for real.

Ban direct calls to time.sleep in src with the ruff TID251 banned-api
table without per-file ignores. Route all direct waits in src through
devops_cli.core.clock.sleep. Keep the single allowed call in
src/devops_cli/core/clock.py under a reasoned noqa comment with its
suppression ceiling recorded at 1.

Add the real_sleep marker to pyproject.toml. Install a PEP 578 audit hook
in tests/conftest.py for time.sleep, and fail tests that exceed the
0.25 s budget without the real_sleep mark. Update tests in
tests/commands/test_pr_update.py to use clock: ClockFake, and mark child
process wait tests with @pytest.mark.real_sleep.

Closes #4669
@dan-petty
dan-petty force-pushed the fix/4669-refuse-real-sleeps-in-tests branch from d5c6c1c to 32b85b6 Compare November 18, 2026 18:25
@dan-petty
dan-petty marked this pull request as ready for review November 18, 2026 18:34
@dan-petty
dan-petty merged commit 918c9f4 into main Nov 18, 2026
33 checks passed
@dan-petty
dan-petty deleted the fix/4669-refuse-real-sleeps-in-tests branch November 18, 2026 20:04
dan-petty pushed a commit that referenced this pull request Nov 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.179.0](v0.178.0...v0.179.0)
(2026-11-18)


### Features

* **config:** Generate declared credentials from config set
([#6318](#6318))
([abe8785](abe8785))


### Bug Fixes

* **roadmap:** judge the registry of the checked-out tree
([#6322](#6322))
([31a15af](31a15af))
* **tests:** refuse real sleeps in tests
([#6317](#6317))
([918c9f4](918c9f4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/tests The test suite, its fixtures, fakes and floor type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tests): refuse real sleeps in tests

1 participant