import decnet.cli as _decnet_cli at module level guarantees the app singleton is built in master mode before any test can set DECNET_MODE=agent. Without this, test_defence_in_depth_direct_call_fails_in_agent_mode triggered a fresh import of decnet.cli with DECNET_MODE=agent active, which stripped master-only commands and wrote the stripped module to sys.modules[decnet].cli — a parent-attribute corruption that no sys.modules dict restore can fix.
3.5 KiB
3.5 KiB