From 97d5173522b52a372fbecc0fbec911191ed0f1c4 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Sat, 14 Feb 2026 16:22:45 -0500 Subject: [PATCH] Fix command registry leaking between tests --- tests/test_commands.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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()