MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / _isolate_root_logger

Method _isolate_root_logger

tests/test_relay_logging.py:102–112  ·  view source on GitHub ↗

Save and restore root logger state to prevent test pollution.

(self)

Source from the content-addressed store, hash-verified

100class TestSetupLogging:
101 @pytest.fixture(autouse=True)
102 def _isolate_root_logger(self) -> Generator[None]:
103 """Save and restore root logger state to prevent test pollution."""
104 root = logging.getLogger()
105 original_handlers = root.handlers[:]
106 original_level = root.level
107 root.handlers.clear()
108 yield
109 for handler in root.handlers:
110 handler.close()
111 root.handlers = original_handlers
112 root.level = original_level
113
114 def test_creates_log_dir_and_handlers(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
115 monkeypatch.setenv("XDG_STATE_HOME", str(tmp_path))

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected