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

Method __take_sys_modules_snapshot

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

Source from the content-addressed store, hash-verified

732 self._sys_path_snapshot.restore()
733
734 def __take_sys_modules_snapshot(self) -> SysModulesSnapshot:
735 # Some zope modules used by twisted-related tests keep internal state
736 # and can't be deleted; we had some trouble in the past with
737 # `zope.interface` for example.
738 #
739 # Preserve readline due to https://bugs.python.org/issue41033.
740 # pexpect issues a SIGWINCH.
741 def preserve_module(name):
742 return name.startswith(("zope", "readline"))
743
744 return SysModulesSnapshot(preserve=preserve_module)
745
746 def make_hook_recorder(self, pluginmanager: PytestPluginManager) -> HookRecorder:
747 """Create a new :class:`HookRecorder` for a :class:`PytestPluginManager`."""

Callers 2

__init__Method · 0.95
inline_runMethod · 0.95

Calls 1

SysModulesSnapshotClass · 0.85

Tested by

no test coverage detected