[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/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:11:57 EDT 2004


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


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/modulealias/tests/test_modulealias.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/modulealias/tests/test_modulealias.py	2004-07-06 16:56:20 UTC (rev 26108)
+++ Zope3/branches/ZopeX3-3.0/src/zope/modulealias/tests/test_modulealias.py	2004-07-06 17:11:57 UTC (rev 26109)
@@ -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