[Zope3-checkins] SVN: Zope3/trunk/src/zope/modulealias/tests/test_modulealias.py Clean up imported module to allow test to run in a loop.

Fred L. Drake, Jr. fred at zope.com
Tue Jul 6 13:17:43 EDT 2004


Log message for revision 26110:
Clean up imported module to allow test to run in a loop.

(This is revision 26109 merged from the ZopeX3-3.0 branch.)



-=-
Modified: Zope3/trunk/src/zope/modulealias/tests/test_modulealias.py
===================================================================
--- Zope3/trunk/src/zope/modulealias/tests/test_modulealias.py	2004-07-06 17:11:57 UTC (rev 26109)
+++ Zope3/trunk/src/zope/modulealias/tests/test_modulealias.py	2004-07-06 17:17:43 UTC (rev 26110)
@@ -63,6 +63,15 @@
         alias_module(module=m1, alias=m2, context=context)
         self.assert_(m1 in sys.modules)
         self.assert_(sys.modules[m1] is sys.modules[m2])
+        # Clean up after ourselves, so the test can be run in a loop:
+        del sys.modules[m1]
+        del sys.modules[m2]
+        # Normal import causes the dummymodule to appear in the
+        # package module as well, so remove it there, since
+        # ConfigurationContext.resolve() will prefer that to
+        # sys.modules.
+        from zope.modulealias import tests
+        del tests.dummymodule
 
     def test_nonmodule_alias(self):
         from zope.modulealias.metaconfigure import ModuleAliasException



More information about the Zope3-Checkins mailing list