[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/versioncontrol/tests.py Changed the version control tests to use the module-masquerading

Jim Fulton jim at zope.com
Mon Jan 17 18:22:59 EST 2005


Log message for revision 28859:
  Changed the version control tests to use the module-masquerading
  helper.
  

Changed:
  U   Zope3/trunk/src/zope/app/versioncontrol/tests.py

-=-
Modified: Zope3/trunk/src/zope/app/versioncontrol/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/versioncontrol/tests.py	2005-01-17 23:22:57 UTC (rev 28858)
+++ Zope3/trunk/src/zope/app/versioncontrol/tests.py	2005-01-17 23:22:59 UTC (rev 28859)
@@ -19,31 +19,19 @@
 import unittest
 
 from zope.component.tests.placelesssetup import PlacelessSetup
-from zope.testing import doctest
+from zope.testing import doctest, module
 from transaction import abort
 
-class FakeModule:
-    def __init__(self, dict):
-        self.__dict = dict
-    def __getattr__(self, name):
-        try:
-            return self.__dict[name]
-        except KeyError:
-            raise AttributeError, name
-
 name = 'zope.app.versioncontrol.README'
 
 ps = PlacelessSetup()
 
 def setUp(test):
     ps.setUp()
-    dict = test.globs
-    dict.clear()
-    dict['__name__'] = name    
-    sys.modules[name] = FakeModule(dict)
+    module.setUp(test, name)
 
 def tearDown(test):
-    del sys.modules[name]
+    module.tearDown(test, name)
     abort()
     db = test.globs.get('db')
     if db is not None:



More information about the Zope3-Checkins mailing list