[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Service/tests - testServiceManager.py:1.1.2.4 testServiceManagerAdder.py:1.1.2.2

Jim Fulton jim@cvs.zope.org
Tue, 19 Feb 2002 11:05:39 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Service/tests
In directory cvs.zope.org:/tmp/cvs-serv7148/lib/python/Zope/App/Service/tests

Modified Files:
      Tag: Zope-3x-branch
	testServiceManager.py testServiceManagerAdder.py 
Log Message:
Refactored tests to use a global-data cleanup framework.
This avoids a lot of messy clean-up code needed for tests that
use global registries, such as component services.

It is really important to make sure global registries get registered
with this framework.

See the doc strings in Zope.Testing.CleannUp.


=== Zope3/lib/python/Zope/App/Service/tests/testServiceManager.py 1.1.2.3 => 1.1.2.4 ===
 
 from Zope.App.Service.ServiceManager import ServiceManager
-from Zope.ComponentArchitecture import getService, _clear
+from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
+from Zope.ComponentArchitecture import getService
 
 class ITestService(Interface): pass
 
@@ -32,7 +33,7 @@
 
     __implements__ = ITestService
 
-class ServiceManagerTests(unittest.TestCase):
+class ServiceManagerTests(CleanUp, unittest.TestCase):
 
     def setUp(self):
         root = RootFolder()


=== Zope3/lib/python/Zope/App/Service/tests/testServiceManagerAdder.py 1.1.2.1 => 1.1.2.2 ===
 
 import unittest, sys
+from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
 
 class DummyFolder:
     pass
 
-class Test(unittest.TestCase):
-
-    def setUp( self ):
-        self._zapServiceImplementations()
-
-    def tearDown( self ):
-        self._zapServiceImplementations()
-
-    def _zapServiceImplementations( self ):
-        from Zope.App.ZMI.Addable import _clear
-        _clear()
+class Test(CleanUp, unittest.TestCase):
 
     def _makeOne( self ):
         from Zope.App.Service.ServiceManagerAdder import ServiceManagerAdder