Fix command registry leaking between tests

This commit is contained in:
Jared Miller 2026-02-14 16:22:45 -05:00
parent 25339edbf5
commit 97d5173522
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -12,6 +12,15 @@ from mudlib.render.ansi import RESET
from mudlib.zone import Zone 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 @pytest.fixture
def mock_writer(): def mock_writer():
writer = MagicMock() writer = MagicMock()