Skip to content

Make the SSIK backend tests isolation-safe - #71

Merged
siddhss5 merged 2 commits into
mainfrom
fix/test-isolation
Sep 19, 2026
Merged

siddhss5 merged 2 commits into
mainfrom
fix/test-isolation

Conversation

@siddhss5

Copy link
Copy Markdown
Collaborator

Why

#70: the adapter fixture reloaded pycbirrt.backends.ssik per test, replacing the SSIKSolver class after the example modules had cached the old one. Reproduced: the three real-model modules together gave 35 passed, 1 failed at the exact type check; each alone passed.

What

  • The production module is imported once at collection and never reloaded. If the optional dependency is absent, a stub ssik module is registered once before that import so the fake-solver contract tests still run; nothing else uses the real package in that case.
  • Import-state checks (core never imports ssik; the actionable missing-dependency message) run in fresh subprocesses, so this process's modules are never mutated.
  • New test asserting the class identity is stable across modules. No assertion in the example tests was weakened.

Fixes #70.

Test plan

  • The three modules together, in both orders: 37 passed each way.
  • Whole suite with MUJOCO_MENAGERIE_PATH: 319 passed, 0 skipped.
  • Core-only clone (no ssik, eaik, or mujoco): test_ssik_backend.py runs the fake adapter tests and the import-state subprocess tests, with the real-SSIK integration class skipped.
  • ruff clean.

🤖 Generated with Claude Code

test_ssik_backend.py reloaded pycbirrt.backends.ssik for every adapter
test, replacing the SSIKSolver class object after the example modules
had cached the previous one, so the combined SSIK + fallback + UR5e
run failed an exact isinstance check while each module passed alone.

Import the production module once at collection and never reload it.
When the optional dependency is absent, register a stub ssik module
once before that import so the fake-solver contract tests still run
without SSIK. Check import-state behavior (core never imports ssik;
the actionable missing-dependency message) in fresh subprocesses
instead of mutating this process's modules. Add a test that the class
identity is stable across modules.

Fixes #70.
…ubbed name

With ssik absent the stub module satisfied importorskip, so the
integration class ran against the stub in a core-only environment.
@siddhss5
siddhss5 merged commit 90bcf45 into main Sep 19, 2026
4 checks passed
@siddhss5
siddhss5 deleted the fix/test-isolation branch September 19, 2026 22:26
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.

Make the SSIK and MuJoCo integration tests isolation-safe

1 participant