Fix command registry leaking between tests
This commit is contained in:
parent
25339edbf5
commit
97d5173522
1 changed files with 9 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue