MCPcopy
hub / github.com/pytest-dev/pytest / test_remove_added

Method test_remove_added

testing/test_pytester.py:309–316  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

307 key = "my-test-module"
308
309 def test_remove_added(self) -> None:
310 original = dict(sys.modules)
311 assert self.key not in sys.modules
312 snapshot = SysModulesSnapshot()
313 sys.modules[self.key] = ModuleType("something")
314 assert self.key in sys.modules
315 snapshot.restore()
316 assert sys.modules == original
317
318 def test_add_removed(self, monkeypatch: MonkeyPatch) -> None:
319 assert self.key not in sys.modules

Callers

nothing calls this directly

Calls 2

restoreMethod · 0.95
SysModulesSnapshotClass · 0.90

Tested by

no test coverage detected