MCPcopy Create free account
hub / github.com/pytest-dev/pytest / __take_sys_modules_snapshot

Method __take_sys_modules_snapshot

src/_pytest/pytester.py:743–753  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

741 self._monkeypatch.undo()
742
743 def __take_sys_modules_snapshot(self) -> SysModulesSnapshot:
744 # Some zope modules used by twisted-related tests keep internal state
745 # and can't be deleted; we had some trouble in the past with
746 # `zope.interface` for example.
747 #
748 # Preserve readline due to https://bugs.python.org/issue41033.
749 # pexpect issues a SIGWINCH.
750 def preserve_module(name):
751 return name.startswith(("zope", "readline"))
752
753 return SysModulesSnapshot(preserve=preserve_module)
754
755 def make_hook_recorder(self, pluginmanager: PytestPluginManager) -> HookRecorder:
756 """Create a new :py:class:`HookRecorder` for a PluginManager."""

Callers 2

__init__Method · 0.95
inline_runMethod · 0.95

Calls 1

SysModulesSnapshotClass · 0.85

Tested by

no test coverage detected