OXYGENHUB

conformance: do not assume index 0 is empty 1b40a077e41f

test_pad_unplug_is_observable asserted `connected` goes false after
connected=0. That is only reachable when nothing physical sits at that
index -- and the SPEC deliberately says `connected` reports whatever is
present, REAL OR VIRTUAL, so a machine with a controller plugged in is
conformant while failing the test.

Found on the first real backend: SDL under Xvfb reports a joystick that
reads as all zeros, so the count is non-zero even on a headless box with
nothing attached.

Now it probes first and skips with a reason if something is already
there, rather than failing a conformant server for the tester's hardware.

Git-Commit: 50cdfcbad897fab00cf5a38730e6fb163914c5c3
Git-Author: Andy McCall <[email protected]>
Author
Andy McCall @andymccall <[email protected]>
When
· 2026-07-28 20:53 UTC
Signature
◈ sealed by Andy McCall
Hash
1b40a077e41ff99aea0d342250dd4b6891315a4150ffcda2edfa7538c4f64e48
Depends on
8ac19619e24b bed0f1e524fe
Depended on by
nothing yet
In bookmarks
main perf-6
Edits
2 atoms, 0 tree operations, 1 file

Browse the tree at this change

modified conformance/test_conformance.py +9 −2
…
267 unchanged lines
268 268
        pytest.skip("contract < 0.5")
269 269
    emu.pause()
270 270
    try:
271 -
        emu.pad(buttons=0)                     # plugged in
272 -
        assert emu.pad_get()["connected"] is True
273 271
        emu.pad(connected=False)
272 +
        if emu.pad_get()["connected"]:
273 +
            pytest.skip(
274 +
                "a physical controller is present at index 0, so `connected` "
275 +
                "cannot go false — the SPEC says it reports anything present, "
276 +
                "real or virtual. Re-run with the controller unplugged.")
277 +
        emu.pad(buttons=0)                     # plugging in is what we assert
278 +
        assert emu.pad_get()["connected"] is True, (
279 +
            "injecting did not make the pad present")
280 +
        emu.pad(connected=False)
274 281
        assert emu.pad_get()["connected"] is False, (
275 282
            "the pad still reports connected after connected=0")
276 283
    finally:
…
2 unchanged lines