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)
| 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 |