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

Method _finalize

src/_pytest/pytester.py:723–732  ·  view source on GitHub ↗

Clean up global state artifacts. Some methods modify the global interpreter state and this tries to clean this up. It does not remove the temporary directory however so it can be looked at after the test run has finished.

(self)

Source from the content-addressed store, hash-verified

721 return f"<Pytester {self.path!r}>"
722
723 def _finalize(self) -> None:
724 """
725 Clean up global state artifacts.
726
727 Some methods modify the global interpreter state and this tries to
728 clean this up. It does not remove the temporary directory however so
729 it can be looked at after the test run has finished.
730 """
731 self._sys_modules_snapshot.restore()
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

Callers 1

finalizeMethod · 0.45

Calls 1

restoreMethod · 0.45

Tested by

no test coverage detected