Skip to main content

importlib-reload-class-identity

Diagnose and fix the silent class-identity drift caused by `importlib.reload()` on modules that define classes whose instances live elsewhere. Use when: (1) a pytest fixture uses `importlib.reload(some_module)` to "flush caches" and downstream tests then fail with `isinstance` checks rejecting objects that LOOK correct; (2) you see a diagnostic warning of the form "expected X, got X" — same class name, different class identity (`type(obj).__name__ == "X"` but `obj is not isinstance(X)`); (3) one fragile test fixture causes dozens-to-hundreds of cascading failures in unrelated test files; (4) tests pass in isolation but fail when run as part of the full suite, with order dependence pointing at the reload site; (5) you have an entry-point / plugin / discovery system whose post-reload registry is empty even though the underlying entries still exist. Covers root cause (Python class objects are first-class identities; reload mints new ones; pre-reload instances keep old identity), the diagnostic signature, and the

Jump to install

Source facts

Repository
cajias/claude-skills
Last source activity
July 20, 2026 at 07:29
Detected SKILL.md language
English
Stars
0
Forks
0

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.