From 630cca2fba4d74dee813708558d7a5fba30e1044 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 2 May 2017 21:05:42 -0300 Subject: [PATCH] Fix py35-trial environment After updating to twisted 17.1.0, again the trial tests started to fail; didn't investigate too deep, decided to just no longer delete "zope" modules when cleaning up after pytester because it seems more zope modules keep global state that shouldn't be discarded --- _pytest/pytester.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_pytest/pytester.py b/_pytest/pytester.py index de24f9044..6ad26c918 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -447,9 +447,10 @@ class Testdir: the module is re-imported. """ for name in set(sys.modules).difference(self._savemodulekeys): - # zope.interface (used by twisted-related tests) keeps internal - # state and can't be deleted - if not name.startswith("zope.interface"): + # some zope modules used by twisted-related tests keeps internal + # state and can't be deleted; we had some trouble in the past + # with zope.interface for example + if not name.startswith("zope"): del sys.modules[name] def make_hook_recorder(self, pluginmanager):