Skip to content

Make native flash, snapshot and token-ID tests deterministic - #18

Merged
trissim merged 3 commits into
mainfrom
fix/deterministic-native-tests
Oct 10, 2026
Merged

trissim merged 3 commits into
mainfrom
fix/deterministic-native-tests

Conversation

@trissim

@trissim trissim commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

main CI (run 38029125833) and PR #17 fail on the same tests. Causes and fixes:

  • Native exposure. actual_surfaces, rendered_canvas and observed_form showed a window and processed events once. On cocoa and Windows a shown window is exposed asynchronously, and only exposed windows receive a flash or a paint, so recipient counts came out 0 or 1 instead of 2 and render captures never completed. The fixtures now wait with qtbot.waitExposed.
  • Transient HOLD. HOLD lasts 50 ms. The tests waited for phase is HOLD while the real clock ran, so under CI load the playback could pass from HOLD to FADE_OUT between polls. A new flash_clock fixture (conftest) replaces the flash coordinator's clock; the tests advance it by fade_in_s explicitly, so HOLD holds until the assertion. Assertions are unchanged.
  • ID reuse. test_native_reused_object_id_does_not_override_restored_token needed CPython to hand the new object the departed object's address, which 3.13 does not do here. The test now moves the departed cache entry onto the new object's id, the state an address reuse produces, and checks the same property (renamed test_reused_object_id_does_not_override_restored_token).

Still failing on 3.13 until python-introspect 0.2.5 is released: test_preview_policy_fields_include_authored_help_for_hidden_controls. python-introspect used the private inspect._ClassFinder, removed in Python 3.13, so all inline field docs came back empty. Fixed in OpenHCSDev/python-introspect#19; after it is released, this branch needs python-introspect>=0.2.5.

Local (Python 3.14, offscreen, with python-introspect from #19): 608 passed, 1 skipped. Flash and snapshot files: 48 passed, 5 runs in a row. Without the clock advance, the three native flash tests time out, so the clock drives them.

🤖 Generated with Claude Code

- Wait for native exposure before flashing: cocoa and Windows expose a
  shown window asynchronously, and only exposed windows receive a flash.
- Drive the flash clock explicitly (flash_clock fixture), so a 50 ms HOLD
  cannot pass between paints while the test waits to observe it.
- Reproduce a reused object ID by moving the departed cache entry onto
  the new object's id instead of relying on the CPython allocator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 10, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

trissim and others added 2 commits October 10, 2026 12:36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
python-introspect 0.2.4 used inspect._ClassFinder, which Python 3.13
removed, so dataclass field help came back empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trissim
trissim merged commit 03c03f5 into main Oct 10, 2026
21 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants