test: cross-file stub-scoping repairs — hub ConfigFlow base carries the full plumbing, standalone rebuilds when its holder is gone, test_init scoped hygiene mirrors scoped_stubs (completes t30 G6)

This commit is contained in:
James Mackay committed 2026-10-09 07:38:24 +01:00
1 parent 80ddff313a
commit e77bc12d81
2 files changed
+40 -3

No files matched your search

+9 -2
View File
@@ -37,8 +37,15 @@ _STUB_NAMES = (
def _install_stubs() -> None:
"""Import-time stand-ins (idempotent; same shape as the pairing tests)."""
if sys.modules.get("voluptuous") is not None:
"""Import-time stand-ins (idempotent; same shape as the pairing tests).
t30: the guard rebuilds whenever the module-level holder is missing —
a later file's scoped teardown may pop the shared stubs this file's
tests rely on (the flow-class surfaces live on the local base which we
MUST rebind against)."""
if sys.modules.get("voluptuous") is not None and hasattr(
sys.modules.get(__name__), "_zc_holder"
):
return
vol = types.ModuleType("voluptuous")