diff --git a/tests/test_commands.py b/tests/test_commands.py index 7ec14c0..003ab98 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -12,6 +12,15 @@ from mudlib.render.ansi import RESET from mudlib.zone import Zone +@pytest.fixture(autouse=True) +def _clean_test_commands(): + """Snapshot and restore command registry to prevent test leakage.""" + snapshot = dict(commands._registry) + yield + commands._registry.clear() + commands._registry.update(snapshot) + + @pytest.fixture def mock_writer(): writer = MagicMock()