[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/AdapterService/tests - testAdapterService.py:1.1.2.6

Jim Fulton jim@zope.com
Sat, 30 Nov 2002 07:44:57 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/AdapterService/tests
In directory cvs.zope.org:/tmp/cvs-serv30047/lib/python/Zope/App/OFS/Services/AdapterService/tests

Modified Files:
      Tag: Zope3-Bangalore-TTW-Branch
	testAdapterService.py 
Log Message:
Refactored the way TTW component registration is done.  There are now
separate registry objects that abstract the machinery for registering
multiple conflicting configurations and deciding which, if any are
active.  Also provided a new field and widget for the status
information.

Along the way, cleaned up and streamlined placeful testing
infrastructure a bit.

Now checking into branch. Will give file-by-file (or at least more
specific logs) when the changes are merged into the head.


=== Zope3/lib/python/Zope/App/OFS/Services/AdapterService/tests/testAdapterService.py 1.1.2.5 => 1.1.2.6 ===
--- Zope3/lib/python/Zope/App/OFS/Services/AdapterService/tests/testAdapterService.py:1.1.2.5	Thu Nov 14 09:39:40 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/AdapterService/tests/testAdapterService.py	Sat Nov 30 07:44:26 2002
@@ -18,75 +18,58 @@
 $Id$
 """
 
-from unittest import TestCase, TestSuite, main, makeSuite
-from Interface import Interface
-from Zope.App.OFS.Services.AdapterService.AdapterService \
-     import AdapterService
-from Zope.App.OFS.Services.AdapterService.tests. \
-     IAdapterRegistrationManagerTests \
-     import IAdapterRegistrationManagerTests, AdapterDirective, Adapter
-from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
-from Zope.App.OFS.Services.ServiceManager.tests.PlacefulSetup \
-     import PlacefulSetup
-from Zope.App.OFS.Services.ServiceManager.ServiceManager import ServiceManager
-from Zope.App.OFS.Services.ServiceManager.ServiceDirective \
-     import ServiceDirective
-from Zope.ComponentArchitecture import getServiceManager
-
-from Interface import Interface
-class I1(Interface): pass
-class I2(I1): pass
-class I3(Interface): pass
-class I4(I3): pass
-class A1(Adapter): pass
-class A2(Adapter): pass
+## from unittest import TestCase, TestSuite, main, makeSuite
+## from Interface import Interface
+## from Zope.App.OFS.Services.AdapterService.AdapterService \
+##      import AdapterService
+## ## from Zope.App.OFS.Services.AdapterService.tests. \
+## ##      IAdapterRegistrationManagerTests \
+## ##      import IAdapterRegistrationManagerTests, AdapterDirective, Adapter
+## from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
+## from Zope.App.OFS.Services.ServiceManager.tests.PlacefulSetup \
+##      import PlacefulSetup
+## from Zope.App.OFS.Services.ServiceManager.ServiceManager import ServiceManager
+## ## from Zope.App.OFS.Services.ServiceManager.ServiceDirective \
+## ##      import ServiceDirective
+## from Zope.ComponentArchitecture import getServiceManager
+
+## from Interface import Interface
+## class I1(Interface): pass
+## class I2(I1): pass
+## class I3(Interface): pass
+## class I4(I3): pass
+## class A1(Adapter): pass
+## class A2(Adapter): pass
    
-class Test(PlacefulSetup, TestCase, IAdapterRegistrationManagerTests):
+## #class Test(PlacefulSetup, TestCase, IAdapterRegistrationManagerTests):
+## class Test(TestCase):
          
-    def setUp(self):
-
-        # XXX Waaaa why so much setup? There must be a better way!
-        PlacefulSetup.setUp(self)
-        self.buildFolders()
+##     def _setUp(self):
 
-        from Zope.ComponentArchitecture.GlobalAdapterService \
-             import provideAdapter
-        from Zope.App.OFS.Services.ServiceManager.IServiceManager \
-             import IServiceManager
-        from Zope.App.Traversing.ITraversable import ITraversable
-        from Zope.App.OFS.Container.IContainer import ISimpleReadContainer
-        from Zope.App.OFS.Container.ContainerTraversable \
-             import ContainerTraversable
-        from Zope.App.Traversing.IPhysicallyLocatable \
-             import IPhysicallyLocatable
-        from Zope.App.Traversing.PhysicalLocationAdapters \
-             import WrapperPhysicallyLocatable, RootPhysicallyLocatable
-        from Zope.App.Traversing.IContainmentRoot import IContainmentRoot
-        from Zope.ComponentArchitecture import getService, getServiceManager
-
-        provideAdapter(ISimpleReadContainer, ITraversable,
-                       ContainerTraversable)
-        provideAdapter(
-              None, IPhysicallyLocatable, WrapperPhysicallyLocatable)
-        provideAdapter(
-              IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
-        
+##         # XXX Waaaa why so much setup? There must be a better way!
+##         PlacefulSetup.setUp(self)
+##         self.buildFolders()
+
+##         from Zope.App.OFS.Services.ServiceManager.IServiceManager \
+##              import IServiceManager
+##         from Zope.App.Traversing.IContainmentRoot import IContainmentRoot
+##         from Zope.ComponentArchitecture import getService, getServiceManager
         
-        sm = ServiceManager()
-        self.rootFolder.setServiceManager(sm)
-        sm = getServiceManager(self.rootFolder)
-        ts = AdapterService()
-        sm.Packages['default'].setObject('test_service1', ts)
-        directive = ServiceDirective(
-            'Adapters',
-            '/++etc++Services/Packages/default/test_service1')
-        sm.Packages['default'].setObject('test_service1_dir', directive)
-        sm.bindService(directive)
-        self.iarm = getService(self.rootFolder, 'Adapters')
+##         sm = ServiceManager()
+##         self.rootFolder.setServiceManager(sm)
+##         sm = getServiceManager(self.rootFolder)
+##         ts = AdapterService()
+##         sm.Packages['default'].setObject('test_service1', ts)
+##         directive = ServiceDirective(
+##             'Adapters',
+##             '/++etc++Services/Packages/default/test_service1')
+##         sm.Packages['default'].setObject('test_service1_dir', directive)
+##         sm.bindService(directive)
+##         self.iarm = getService(self.rootFolder, 'Adapters')
 
             
-def test_suite():
-        return makeSuite(Test)
+## def test_suite():
+##         return makeSuite(Test)
 
-if __name__=='__main__':
-    main(defaultTest='test_suite')
+## if __name__=='__main__':
+##     main(defaultTest='test_suite')