Repository navigation
test: wait on conditions, and fail a new test sleep or timer - #1036
Conversation
) Tests that waited on a fixed time.sleep or threading.Timer for another thread or process failed on a slow runner, and each file wrote its own polling loop. tests/waiting.py gives poll_until (False at the deadline), wait_until (pytest.fail naming what it waited for) and wait_for_event; pid_state.wait_until_gone is rebuilt on poll_until with the same signature and result. scripts/check_test_timing.py counts, per file under tests/, the calls that resolve to time.sleep or threading.Timer through the file's imports and fails a count above or below its entry in scripts/test_timing_baseline.json, or a bare `# timing-ok`; --update only lowers entries. It runs in the static job of ci.yml. AGENTS.md and REVIEW.md name the helper and the check. test_pid_state.py patches the time module instead of pid_state.time, which pid_state no longer imports. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
OpenCodeReview: Commit 35f55ac was not reviewed. This PR has reached its review limit (6 reviews). CI at `35f55ac`: 9 still running, 3 passing, 1 skipped
To review this commit: re-request review from exai-bot in the Reviewers list. <details><summary>Last review (1b3e6ad): no findings</summary> Open threads from the bot: 0 </details> |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1036 +/- ##
========================================
Coverage 95.91% 95.91%
========================================
Files 448 450 +2
Lines 59389 59527 +138
Branches 10240 10265 +25
========================================
+ Hits 56963 57098 +135
- Misses 1506 1507 +1
- Partials 920 922 +2 🚀 New features to boost your workflow:
|
… bad root; poll_until does not sleep past its deadline Settles three review points on intel#1036. check_test_timing.py resolved every import of a file in one table, so `import threading as t` in one test hid `import time as t; t.sleep()` in another. A name now means what the innermost scope that binds it says (function, lambda, module; a class body is not visible from its methods), and a parameter, assignment or def of the same name shadows an import. `--tests-root` that is not a directory now exits 2 before anything is scanned, so `--update` cannot replace the baseline with an empty one. poll_until slept a full interval even when less time was left, so a condition that became true after the deadline was accepted. It now sleeps at most the remaining time, then makes its last call. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
vchamarthi
left a comment
There was a problem hiding this comment.
🔴 Changes needed: 1 must-fix, 1 nit · reviewed adfc656
Next: @antonwolfy: fix the 1 must-fix finding, answer 3 open threads from exai-bot and settle 3 open questions; then push for a re-review. 1 nit optional.
Blocking
- Still holds on this head: thread by exai-bot –
import time,time.sleep(1)and thentime = Nonescan to zero calls on the head, so the sleep is not counted. - Still holds on this head: thread by exai-bot –
[time for time in ()]beforetime.sleep(1)scans to zero calls on the head, so the sleep is not counted. - Still holds on this head: thread by exai-bot – A nap that advances the clock by 0.5 s makes
poll_until(..., 0.01, interval=1)return True on the head, after the deadline. - Open question for @antonwolfy: Issue #1034 asks
tests/waiting.pyfor a pid-exit helper next to the event helper. Move the pid wait intotests/waiting.py, or state in the description thatwait_until_goneis that helper. - Open question for @antonwolfy: A name bound to
time.sleepby assignment (nap = time.sleep, thennap(1)) scans to zero calls, though the docstring counts the calls the imports resolve to. Count the assignment, or state in the docstring that only imports are followed. - Open question for @antonwolfy:
--updatewith no baseline file writes the counts of the whole tree, so a new sleep enters the baseline, while the--updatehelp says it never raises an entry. Refuse the first write unless the file is missing on purpose, or change the help text to say the first write sets every count.
Verified on adfc656: ✅ changed tests: 49 passed, fail on main · ✅ full suite with main merged in: 23978 passed · ✅ merges onto main · ✅ 12 broken variants of the changed code: 11 caught by the tests · 1 mutation tried · 9 edge inputs tried
14 checks behind it, each with its evidence
| Area | What holds | How |
|---|---|---|
| Changed tests | The three changed test files pass on the head, 49 cases, and pin the counting, scoping, root, waiver, poll_until, wait_until, wait_for_event and wait_until_gone behaviour |
tests on the head |
| Root check | A --tests-root that is missing or is a file exits 2 with the baseline unchanged, with or without --update, as test_a_tests_root_that_is_not_a_directory_exits_2_and_leaves_the_baseline_alone pins |
tests on the head, edge input (paths) |
| Waivers | A call on a line with # timing-ok: <reason> is not counted, and a bare # timing-ok fails with its line number, as the waiver tests pin |
tests on the head |
| New tests on main | On main the new check test module fails to import, since check_test_timing is not there, so the tests are new and not vacuous |
same tests on main |
| Baseline count | The tests tree counts 22 sleep or timer calls in 14 files, 20 time.sleep and 2 threading.Timer, which is the sum of the committed baseline |
ran it |
| Full check | The full check run on the head merged onto main has 0 failed, 26 passed and 20 skipped |
full suite, main merged in |
| Merge | The head merges onto main with no conflict |
merge onto main |
| Line endings and non-ascii | A CRLF file with a non-ASCII comment counts its sleep, and a waiver with a reason on a CRLF line is not counted | ran it, edge input (text) |
| Empty root and dump order | An empty tests root measures as no calls, and the baseline dump lists its entries in sorted order | ran it, edge input (collections) |
| Zero and negative timeout | poll_until with a timeout of 0 or -1 calls the predicate once and returns False |
ran it, edge input (numbers) |
| Baseline shape | A baseline with no files key loads as empty, and an extra key is ignored |
ran it, edge input (structured) |
| Option without a value | --tests-root with no value exits 2 through argparse |
ran it, edge input (cli) |
| Relative root | A relative --tests-root is read from the working directory and its keys read tests/... |
ran it, edge input (paths) |
| Scope lookup | Negating the name lookup in _resolve (dokimi/scripts/check_test_timing.py:94) fails the changed tests |
broke the code, tests caught it |
…l_until rejects a late success
Settles the open review points on the timing check and the waiting helper.
- A name means its last binding before the call in the scope the call stands in, so `import time`, `time.sleep(1)`, `time = None` counts the sleep, also in a function. A scope around a function still gives its last binding.
- A comprehension has its own scope: its targets do not rebind the name outside, its first iterable is read outside it, and a `:=` binds outside.
- `from time import *` and `from threading import *` bind `sleep` and `Timer`.
- A baseline that is not `{"files": {<file>: <count>}}`, and a test file that cannot be read or parsed (non-UTF-8, dangling symlink, syntax error), exit 1 with a message naming it instead of a traceback.
- `poll_until` checks the clock after each sleep and returns False when the predicate holds only after the deadline; the first call is still made whatever the timeout.
- The docstring says only imports are followed (`nap = time.sleep` is not), and the `--update` help says a missing baseline is written with every current count.
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@vchamarthi (#1036 (review)): The three threads are answered in their own replies. The three open questions:
|
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
… test_run_wide_stop Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…ion binds after its first iterable A `:=` inside a lambda within a comprehension is local to the lambda, so it no longer shadows the module's `time` and hides a later `time.sleep`. A `:=` in a comprehension element now takes effect after the first iterable, which Python evaluates first, so a sleep in that iterable is still counted. Settles review threads 4642394496 and 4642394503. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…losely Settles the open review threads on check_test_timing.py and waiting.py. A name declared global or nonlocal is not local to the function, so its rebinding no longer hides an import. An annotation with no value binds nothing in a module or class body. A for target binds after its iterable. A class body looks up outer names by position, as it runs where it stands. A walrus in a comprehension is hidden only from the first iterable of each comprehension around it, not from the rest of the element, and a lambda's default (not its body) binds it. poll_until now checks the clock after every call but the first, so a later call that returns a truthy value after the deadline is not accepted. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Review points answered at Follow-up issues opened:
|
vchamarthi
left a comment
There was a problem hiding this comment.
🔴 Changes needed: 1 must-fix, 1 nit · re-reviewed a816ab1
Next: @antonwolfy: fix the 1 must-fix finding; then push for a re-review. 1 nit optional.
Verified on a816ab1: ✅ changed tests: 86 passed, fail on main · ✅ full suite with main merged in: 24317 passed · ✅ merges onto main ·
14 checks behind it, each with its evidence
| Area | What holds | How |
|---|---|---|
| Changed tests | tests/test_check_test_timing.py, tests/test_pid_state.py and tests/test_waiting.py pass on the head: 86 cases |
tests on the head |
| Changed tests on main | The same three files fail on main: tests/test_check_test_timing.py cannot be collected, since check_test_timing is not there |
same tests on main |
| Merge | The head merges onto main with no conflict | merge onto main |
| Full suite | The full check with main merged in has 0 failed, 26 passed and 20 skipped | full suite, main merged in |
| Poll_until deadline | Replacing the deadline check on line 31 of tests/waiting.py with return True fails tests/test_waiting.py |
broke the code, tests caught it |
| Measure, unreachable raise | The raise that the mutant adds after the continue at line 310 of check_test_timing.py is unreachable, so a dangling symlink is a problem line, not an exception |
ran it |
| Main, unreachable raise | The raise that the mutant adds after return 1 at line 378 of check_test_timing.py is unreachable, so a baseline that is not one still exits 1 with a message |
ran it |
| Text input | CRLF, a U+2028 in a comment and CR-only line endings all count the time.sleep call |
ran it, edge input (text) |
| Argv none | main(None) reads sys.argv, and a baseline with no entries passes a tree with no calls |
ran it, edge input (none) |
| Baseline order and repeats | dump_baseline writes the entries sorted, and a repeated import is one binding that counts one call |
ran it, edge input (collections) |
| Missing tests root | A missing --tests-root with --update exits 2 and leaves the baseline as it was |
ran it, edge input (paths) |
| Zero and negative timeout | poll_until with a timeout of 0 or -1 calls the predicate once and returns False |
ran it, edge input (numbers) |
| Baseline shape | A baseline that is a list, has a null count or has "files": null is refused, and {} loads as no entries |
ran it, edge input (structured) |
| Unknown option | An unknown option makes main exit 2 through argparse |
ran it, edge input (cli) |
…r base, and refuses a baseline count that is not an int A `:=` in a def or lambda default, a decorator, or a class base runs in the enclosing scope, so it now binds there like one in a comprehension; `f = lambda x=(time := None): x` then `time.sleep(1)` is no longer counted. `load_baseline` took `1.9` and `"2"` as 1 and 2 through `int()`; it now accepts only an int count and raises `ValueError` otherwise, as its docstring says. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@vchamarthi (#1036 (review)): Covers the two threads above (4646800665, 4646800704), both fixed in 510efc1. The two broken variants the review reports as not caught were the unreachable |
…r, or after an unconsumed generator A generator expression binds a `:=` in its body only when it runs, so a `time := None` in one no longer hides a later `time.sleep`; only its first iterable binds where it stands. The element of a list, set or dict comprehension runs after every iterable and filter, so a call in a filter or a later iterable no longer sees the element's `:=`. Parameter and return annotations of a def are read as calls where the def stands, unless the file has `from __future__ import annotations`. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…and skips annotations that never run A walrus in a parameter or return annotation of a def rebinds its name where the def runs (unless annotations are postponed), so a later call of the old import is not a timer: the binding pass now visits those annotations. The annotation of `x: T` is not evaluated when annotations are postponed or the statement is in a function body, so a sleep call in it is no longer counted. The value and the target are still walked, and a module or class level annotation is still read. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…ts a filter's binding reach the element A local `x: (time := None)` is never evaluated, so the binding pass no longer records its walrus (a later `time.sleep` was missed), with or without a value or `from __future__ import annotations`. A `:=` in the iterable or a filter of a list, set or dict comprehension runs before the element, so it now takes effect where the element starts and not in the text between the element's end and the `:=`; `[sleep(1) for _ in (0,) if (sleep := f)]` no longer counts a sleep. Nested comprehensions lift to each element around them. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Review points answered at codecov has not reported on this head yet. |
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 1b3e6ad)
- Contract: changed. cli dokimi/scripts/check_test_timing.py
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
Checked test waiting helpers, alias resolution, baseline enforcement and waiver handling. I left 2 inline comments.
Focused pytest run on 1b3e6ad74: 111 passed in 23.46s. CI on head 1b3e6ad: 0 failing Actions jobs.
…refuses a baseline with no files key
Settles the two threads on check_test_timing.py.
A name bound in different arms of an if, try or match (time.sleep as wait on Windows, a helper elsewhere) took the last binding in the text, so the Windows wait was not counted. Each binding now records the arms it stands in. Where the arms meet, a call counts when any binding that may have run is a sleep or timer; a later binding made on every path to it, or one in an arm the call is not in, still hides an earlier one.
load_baseline read a missing files key as an empty baseline, so a misspelled key passed with exit 0. The key is now required; an explicit {"files": {}} is still accepted.
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@napetrov (#1036 (review)): The review body only recaps its checks and lists the two threads above, 4654575355 and 4654575358, answered there. |
Summary
Tests that wait on a fixed
time.sleeporthreading.Timerfor another thread or process to reach a state fail on a slow or busy runner: the Ctrl-C lifecycle test was fixed four times, the SIGTERM reach test twice, andtests/test_run_wide_stop.pystill races a 0.2 s timer. Onmainthere is no shared helper to wait on a condition (each file writes its own polling loop), and nothing stops the next sleep: running the new check overmain'stests/with an empty baseline exits 1 with 15 files above their (missing) entry.The issue counts 73
time.sleep(and 2threading.Timer(by grep. The AST count is lower, 23 calls in 15 files onmain(21time.sleepand 2threading.Timer), because most grep hits are a child's source or shell command inside a string ("import time; time.sleep(60)"), which is not a call. This PR'spid_state.pyloses its one sleep, andmainhas since removed the sleep intests/test_run_wide_stop.py, so the baseline holds 21 calls in 13 files (20time.sleep, 1threading.Timer).The fix is the helper plus the check. Moving the existing sleeps onto the helper is out of scope: the baseline holds them and only shrinks. The elapsed-time assertion is left to review (
REVIEW.md).Closes #1034
Changes
tests/waiting.py(new):poll_until(predicate, timeout, interval=0.02) -> bool(False at the deadline, never raises; it sleeps at most the time left and checks the clock after each sleep, so a condition that becomes true only after the deadline is not accepted, also when a sleep overshoots it or a later call is slow; the first call is made whatever the timeout),wait_until(predicate, timeout, *, what, interval=0.02)(returns the first truthy value, otherwisepytest.fail("gave up after <timeout> s waiting for <what>");whatis required) andwait_for_event(event, timeout, *, what).tests/pid_state.py:wait_until_goneis the pid-exit wait the issue asks for next to the event helper; it stays beside the other pid helpers and is rebuilt onpoll_until, with the same signature and result (the pids still running aftergrace_s, no failure). Itstime.sleepis gone.tests/test_pid_state.pypatches thetimemodule where it patchedpid_state.time, whichpid_stateno longer imports; its assertions are unchanged.scripts/check_test_timing.pyandscripts/test_timing_baseline.json(new, stdlib only): counts, per file undertests/, the calls the file's imports resolve totime.sleeporthreading.Timer(import time,import time as t,from time import sleep [as nap],from time import *, and the same forTimer). Only imports are followed:nap = time.sleepthennap(1)is not counted. A name means what the innermost scope that binds it says (function, lambda, comprehension, module; a class body is not visible from its methods), soimport threading as tin one test does not hideimport time as t; t.sleep()in another, and a parameter, assignment ordefof the same name shadows an import. In the scope a call stands in, the last binding before the call counts, soimport time,time.sleep(1),time = Nonecounts the sleep; a comprehension's targets stay in it ([time for time in ()]does not rebindtime), its first iterable is read outside it and a:=binds outside, taking effect after that first iterable of each comprehension around it (which Python runs first) but not hidden from the rest of the element, while a:=inside a lambda's body in the comprehension stays local to the lambda (its defaults bind outside); a:=in adefor lambda default, a decorator or a class base binds in the scope around it too. A name declaredglobalornonlocalin a function is not local to it, so rebinding it does not hide an import; an annotation with no value (time: object) binds nothing in a module or class body; afortarget binds after its iterable; a class body reads outer names by position, as it runs where it stands. The element of a list, set or dict comprehension runs after its iterables and filters, so its:=is not in effect for a call in a filter or a later iterable; a generator expression runs only its first iterable where it stands, so a:=in the rest of it binds nothing around it. Adef's parameter and return annotations are read as calls where thedefstands (they run there before Python 3.14), unless the file hasfrom __future__ import annotations; a:=in one of those annotations rebinds its name in the scope around thedef(also unless postponed), so a later call of the old import is not counted. The annotation ofx: Tis not read as a call when annotations are postponed or the statement is in a function body (where Python never evaluates it); its value is, and a module or class level annotation otherwise is; a:=in an annotation that is not evaluated rebinds nothing, with or without a value. A:=in the iterable or a filter of a list, set or dict comprehension (also a nested one) runs before the element, so it is in effect for the element even though the element stands first in the text, and not for a call that runs before it. A string is not a call. Where branches meet (if/else,try/except,matchcases), a name counts when any branch may have bound it to a sleep or timer, sotime.sleep as waiton Windows andmy_helpers.waitelsewhere is counted; a later binding on every path to the call, or a binding in an arm the call is not in, still hides an earlier one. A baseline that is not{"files": {<file>: <count>}}with integer counts (1.9and"2"are refused; a missingfileskey is refused, an explicit{"files": {}}is accepted), and a test file that cannot be read or parsed, exit 1 with a message naming it. A--tests-rootthat is not a directory exits 2 before anything is scanned or written.tests/waiting.pyis not counted. A count above its entry, a file with no entry, or a count below its entry fails (exit 1), as inscripts/check_growth.py.--updatelowers or drops entries, refuses (exit 1, baseline untouched) while any file is above its entry, and writes a first baseline when the file is missing (every file at its current count; the--updatehelp says so). A call whose first or last line ends with# timing-ok: <reason>is not counted; a# timing-okwith no reason fails with its file and line..github/workflows/ci.yml: aTest timing ratchetstep in thestaticjob afterDuplicate code ratchet(make ci-locallists it from the workflow).tests/test_check_test_timing.pyandtests/test_waiting.py(new), plus a test that runs the check on the repo's own tree and baseline.AGENTS.mdandREVIEW.md: a bullet each, naming the helper and the check.dokimi/dokimi/changes.Risk
A test-only change. Anyone who adds a
time.sleeporthreading.Timertotests/now fails thestaticjob unless the line says# timing-ok: <reason>; anyone who removes one must runpython scripts/check_test_timing.py --update, because a count below its entry fails too. The open PR that removes thethreading.Timerintests/test_run_wide_stop.py(#987) lowers a count: whichever of the two merges second runs--update. #958 changes therun:line ofguidance self-scan (L0)two lines below the new step, which sits betweenDuplicate code ratchetand that step and leaves its lines untouched:git merge-treeof this branch with #958's head mergesci.ymlcleanly.Testing
On a Linux review host, at
35f55acc(onmain2701798):make ci-local: 37 passed, 0 failed, 14 skipped (steps that need other Pythons, micromamba, semgrep, a deploy or a PR event). 24310 tests passed, 0 failed, 19 skipped. TheTest timing ratchetstep at this head printed:test timing ratchet ok: 21 sleep/Timer call(s) in 13 file(s): 1 threading.Timer, 20 time.sleep.main's tree with only this branch'stests/waiting.py,scripts/check_test_timing.pyandscripts/test_timing_baseline.jsonadded (main'stests/pid_state.pykeeps itstime.sleep):tests/test_check_test_timing.py: 1 failed, 26 passed.test_the_repo_tree_holds_its_own_baselinefails ontests/pid_state.py: 1 sleep/Timer call(s), above no baseline entry, which is the check refusing a sleep its baseline does not hold.tests/test_waiting.py: 5 passed. The helper is new, so there is no old behaviour for it to fail on.from time import sleepresolution fails the twofrom time importcases oftest_each_way_to_import_a_sleep_or_timer_is_counted; counting an empty# timing-ok:reason as waived fails the three cases oftest_a_waiver_without_a_reason_fails_naming_its_line; skipping the under-baseline failure failstest_a_count_under_its_entry_fails_until_update_lowers_it; letting--updaterun with a file above its entry failstest_update_refuses_while_a_file_is_over_its_entry_and_leaves_the_baseline_alone; not exemptingwaiting.pyfailstest_waiting_py_is_not_counted; not resolvingthreading.Timerfails its four import cases;wait_untilreturning before the predicate holds failstest_wait_until_returns_the_value_of_the_call_that_turned_truthy; droppingwhatfromwait_until's and fromwait_for_event's message failstest_wait_until_fails_at_the_deadline_naming_what_it_waited_for_and_for_how_longandtest_wait_for_event_fails_naming_what_it_waited_for_when_the_event_is_never_set;poll_untilraising at the deadline failstest_poll_until_returns_false_at_the_deadline_and_true_once_the_predicate_holds.test_a_name_means_what_the_innermost_scope_that_binds_it_says; skipping theis_dircheck fails both cases oftest_a_tests_root_that_is_not_a_directory_exits_2_and_leaves_the_baseline_alone; sleeping a fullintervalinpoll_untilfailstest_poll_until_never_sleeps_past_the_deadline_so_a_late_condition_is_not_accepted(a fake clock, interval 1 s, timeout 0.01 s, condition true from 0.5 s: it returns True instead of False). All three tests also fail on the previous head's code.test_a_name_means_what_the_innermost_scope_that_binds_it_says; binding a comprehension's targets in the enclosing scope, or not reading its first iterable outside, fails the same test; afrom time import *that binds nothing failstest_each_way_to_import_a_sleep_or_timer_is_counted; accepting{"files": null}or not catching a baseline error failstest_a_baseline_that_is_not_one_fails_naming_it; not catching a non-UTF-8 file, a dangling symlink or a syntax error failstest_a_test_file_that_cannot_be_read_fails_naming_it_instead_of_raising; ignoring the clock after a sleep failstest_poll_until_does_not_accept_a_condition_reached_while_a_sleep_overshot_the_deadline(a fake clock whose sleep advances 0.5 s, timeout 0.01 s: it returned True, now False).(lambda: (time := None))case oftest_a_name_means_what_the_innermost_scope_that_binds_it_says, and binding a comprehension walrus at its own position instead of after the first iterable fails the[(time := None) for _ in (time.sleep(1),)]case of the same test.global/nonlocalhandling fails theglobal timeandnonlocal timecases oftest_a_name_means_what_the_innermost_scope_that_binds_it_says; binding a valueless annotation fails its module and class cases; binding afortarget at its own position failsfor time in (time.sleep(1),); not reading outer names by position from a class body failsclass T: time.sleep(1)followed bytime = None; skipping lambda defaults in the walrus search fails(lambda x=(time := None): x); ignoring the spans that hide a walrus fails the element-walrus and nested-comprehension cases; keeping only the innermost comprehension's span fails[[(time := None) for x in (0,)] for _ in (time.sleep(1),)]. Accepting any truthy laterpoll_untilcall regardless of the clock failstest_poll_until_does_not_accept_a_value_a_slow_later_call_returns_after_the_deadline(a fake clock whose second predicate call advances 0.1 s, timeout 0.01 s: it returned True, now False).def's defaults, decorators and class bases for a:=fails thedef f(x=(time := None)), decorator and class-base cases oftest_a_name_means_what_the_innermost_scope_that_binds_it_says; not reading a lambda outside a comprehension for one failsf = lambda x=(time := None): x; accepting a float or string count throughint()fails both new cases oftest_a_baseline_that_is_not_one_fails_naming_it.tests/test_check_test_timing.pyhas 91 cases, 11 of them new): letting a generator expression's body bind its:=fails((time := None) for _ in (0,))followed bytime.sleep(1)(1 failed); not hiding the element's:=from the iterables and filters fails the filter, later-iterable and dict-comprehension cases (6 failed); not reading annotations fails the parameter, return and*args/**kwargscases (3 failed). Afrom __future__ import annotationsfile counts none of them.tests/test_check_test_timing.pyhas 99 cases, 8 of them new): not binding a:=from a parameter or return annotation fails both rebinding cases (def test_a(x: (sleep := ...))and-> (sleep := ...), 2 failed); reading the annotation ofx: Tregardless of postponement or function scope fails the postponed module case and the function-local case (2 failed).tests/test_check_test_timing.pyhas 111 cases, 12 of them new): reading the annotation of a localx: (time := None)orx: (time := None) = 0, or of a postponed module one, fails those three cases (3 failed); binding a:=of an iterable or filter only after its own text fails the list, set, dict, first-iterable, second-generator and nested cases (8 failed).fileskey (tests/test_check_test_timing.pyhas 126 cases, 15 of them new): readingfileswith a default of{}fails the{}and{"wrong_key": {}}cases oftest_a_baseline_that_is_not_one_fails_naming_it(2 failed); keeping only the last binding of a name instead of every one that may have run fails 6 cases oftest_a_name_bound_differently_in_each_branch_counts_when_any_branch_makes_it_a_sleep; keeping every earlier binding, never hidden by a later one, fails 27 cases across that test and the scoping test.Open questions
None.
Revert
A plain revert removes the helper, the check, its baseline, the CI step and the two doc bullets, and restores
wait_until_gone's own loop. Nothing is stored.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)