FIX SVM click-simulation tests failing on headless CI - #57
Merged
Conversation
The display guard added with the non-interactive training path made two
existing tests environment dependent:
test_nonsquare_training_samples_use_opencv_xy_as_numpy_yx
test_nonsquare_output_shape_and_pixel_order
Both drive the interactive path with every cv2 entry point mocked, but they do
not mock display_is_available(). On a workstation DISPLAY is set, so the guard
passes and the mocked window runs; on a headless runner the guard fires first
and process() raises before reaching the simulated clicks.
Force the display check on in _run_process_with_clicks, matching what the ESC
interrupt test already does. The helper mocks the whole GUI, so the real
availability of a display is irrelevant to what these tests assert.
Test-only change; no library behavior is affected. Verified with the full
suite run under `env -u DISPLAY -u WAYLAND_DISPLAY`, which reproduces the CI
environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the red
FEZrs Testsrun onmain(run 32463258511).What broke
My fault, from the non-interactive SVM PR. That PR added a display check in front of the OpenCV window so a headless run raises a catchable error instead of Qt aborting the process. These two pre-existing tests drive the interactive path with every
cv2entry point mocked — but notdisplay_is_available(). The guard runs before any of the mocked calls, so:DISPLAYis set → guard passes → mocked window runs → tests passDISPLAY→ guard raises →process()never reaches the simulated clicks → tests failI updated
test_process_creates_rgb_stackfor exactly this when I changed its ESC behaviour, but missed these two because they live in a separate helper further down the file and passed locally.Fix
Force the display check on inside
_run_process_with_clicks, matching what the ESC test already does. The helper mocks the entire GUI, so whether a real display exists is irrelevant to what these tests assert.Test-only change. No library behaviour is affected, and the guard itself is unchanged.
Verification
Ran the full suite under
env -u DISPLAY -u WAYLAND_DISPLAY, which reproduces the CI environment:Previously headless gave 2 failures. Worth noting for future changes to this module: a plain local
pytestrun does not exercise the headless path, so anything touching the display guard should be checked withDISPLAYunset.