Skip to content

Fix stale VHI interface + public-API tests (pre-existing, since v2.0.0)#7

Merged
RaulSimpetru merged 2 commits into
mainfrom
fix/stale-vhi-publicapi-tests
Jun 4, 2026
Merged

Fix stale VHI interface + public-API tests (pre-existing, since v2.0.0)#7
RaulSimpetru merged 2 commits into
mainfrom
fix/stale-vhi-publicapi-tests

Conversation

@RaulSimpetru

@RaulSimpetru RaulSimpetru commented Jun 4, 2026

Copy link
Copy Markdown
Member

What

Fixes 7 pre-existing test failures that have been broken since the v2.0.0 rewrite (confirmed: they fail on current main). These are stale tests that drifted from the code — test-only changes, no production code touched.

The failures

test_public_api.py::test_top_level_names_are_reachable

  • Hardcoded COL_WIDTH/ROW_HEIGHT in its expected set; those names were removed in 2.0 (the package now exports Px/Fr/EdgeTrigger).
  • Fix: iterate myogestic.__all__ and assert each name is reachable — robust to future additions/renames.

6 × test_interfaces.py (VHI launcher)

  • Assumed the old Virtual-Hand-Interface install path (now tools/MyoGestic-VHI) and a Godot source-mode default (2.0 prefers the installed binary).
  • The _real_paths helper created a project dir without a project.godot file, which the 2.0 resolver now requires for source mode → launcher() correctly raised.
  • Fix: modernize the tests to current virtual_hand() / _resolve_vhi_launch semantics and make them hermetictmp_path + monkeypatch, create project.godot, no dependency on a real Godot/VHI install or machine paths.

Result

uv run pytest -q163 passed, 0 failures.

Why separate from the OTB PR (#6)

Unrelated to the OTB device-sources feature; kept on its own branch so each PR stays focused. (#6 is purely additive and these failures pre-date it.)

- `_real_paths` now creates `project.godot` (required for source-mode
  resolution in `_resolve_vhi_launch`); tests that need source mode
  use it; tests that need "not installed" use a plain dir without it.
- `test_virtual_hand_default_paths`: removed stale Godot-binary/old-
  path assertions; now asserts `install_root` resolves to
  `tools/MyoGestic-VHI` (the 2.0 default), also clears VHI_LAUNCH_MODE.
- `test_virtual_hand_env_overrides` / `test_virtual_hand_explicit_args_win_over_env`:
  use `tmp_path` instead of literal `/tmp/vhi`/`/opt/godot`; create
  `project.godot` so env-driven source mode resolves correctly.
- `test_launcher_returns_process_tuple_list` / `test_launcher_returns_independent_copy` /
  `test_launcher_accepts_binary_on_path`: all inherit the new
  `project.godot`-aware `_real_paths`; each also clears VHI_LAUNCH_MODE.
- Previously-passing tests (`test_launcher_raises_when_binary_missing`,
  `test_launcher_raises_when_path_missing`) are adjusted to remain
  hermetic while keeping their original intent.
Replaced a hardcoded expected set (which included `COL_WIDTH` and
`ROW_HEIGHT` removed in the 2.0 rewrite) with a loop over the actual
`myogestic.__all__`. The test now asserts that `__all__` is non-empty
and that every name it advertises is reachable via `hasattr`, so it
stays correct as the public surface evolves.
@RaulSimpetru RaulSimpetru force-pushed the fix/stale-vhi-publicapi-tests branch from 1349c09 to c9c06a9 Compare June 4, 2026 07:26
@RaulSimpetru RaulSimpetru merged commit c9ab34b into main Jun 4, 2026
2 checks passed
@RaulSimpetru RaulSimpetru deleted the fix/stale-vhi-publicapi-tests branch June 4, 2026 08:02
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.

1 participant