[Zope3-checkins] CVS: Zope3/src/zope/app/introspector/tests - test_introspector.py:1.2 test_introspectorview.py:1.2

Suresh Babu Eddala sbabu at zeomega.com
Fri Mar 5 10:54:40 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/introspector/tests
In directory cvs.zope.org:/tmp/cvs-serv11790/src/zope/app/introspector/tests

Modified Files:
	test_introspector.py test_introspectorview.py 
Log Message:


removed local interface service stuff, it uses global utility service.




=== Zope3/src/zope/app/introspector/tests/test_introspector.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/introspector/tests/test_introspector.py:1.1	Mon Mar  1 05:18:21 2004
+++ Zope3/src/zope/app/introspector/tests/test_introspector.py	Fri Mar  5 10:54:39 2004
@@ -12,25 +12,18 @@
 #
 ##############################################################################
 """
+
+Revision information:
 $Id$
 """
-from unittest import TestCase, TestSuite, main, makeSuite
-
-from zope.interface import Interface, Attribute, implements, directlyProvides
-from zope.interface.verify import verifyObject
-from zope.component.service import serviceManager, defineService
-from zope.testing.cleanup import CleanUp
-
-from zope.app.process.bootstrap import addConfigureService
-from zope.app.services.servicenames import Interfaces
-from zope.app.services.interface import LocalInterfaceService
-from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.app.component.globalinterfaceservice import provideInterface
-from zope.app.component.globalinterfaceservice import InterfaceService
-from zope.app.interfaces.component import IInterfaceService
 
+from unittest import TestCase, TestSuite, main, makeSuite
 from zope.app.introspector import Introspector
 from zope.app.introspector.interfaces import IIntrospector
+from zope.interface import Interface, Attribute, implements, directlyProvides
+from zope.interface.verify import verifyObject
+from zope.app.component.interface import provideInterface
+from zope.app.tests import placelesssetup
 
 class ITestClass(Interface):
     def drool():
@@ -68,23 +61,20 @@
     def namesAndDescriptions(self):
         return "indeed"
 
-class TestIntrospector(CleanUp, TestCase):
+class TestIntrospector(TestCase):
     """Test Introspector."""
 
     def setUp(self):
-        service = InterfaceService()
-        defineService(Interfaces, IInterfaceService)
-        serviceManager.provideService(Interfaces, service)
-        provideInterface = service.provideInterface
-        provideInterface('zope.app.introspector.tests.test_introspector.I', I)
-        provideInterface('zope.app.introspector.tests.test_introspector.I2', I2)
-        provideInterface('zope.app.introspector.tests.test_introspector.I3', I3)
-        provideInterface('zope.app.introspector.tests.test_introspector.I4', I4)
-        provideInterface('zope.app.introspector.tests.test_introspector.M1', M1)
-        provideInterface('zope.app.introspector.tests.test_introspector.M2', M2)
-        provideInterface('zope.app.introspector.tests.test_introspector.M3', M3)
-        provideInterface('zope.app.introspector.tests.test_introspector.M4', M4)
-        provideInterface('zope.app.introspector.tests.test_introspector.ITestClass',
+        placelesssetup.setUp()
+        provideInterface('zope.app.tests.test_introspector.I', I)
+        provideInterface('zope.app.tests.test_introspector.I2', I2)
+        provideInterface('zope.app.tests.test_introspector.I3', I3)
+        provideInterface('zope.app.tests.test_introspector.I4', I4)
+        provideInterface('zope.app.tests.test_introspector.M1', M1)
+        provideInterface('zope.app.tests.test_introspector.M2', M2)
+        provideInterface('zope.app.tests.test_introspector.M3', M3)
+        provideInterface('zope.app.tests.test_introspector.M4', M4)
+        provideInterface('zope.app.tests.test_introspector.ITestClass',
                          ITestClass)
 
     def test_isInterface(self):
@@ -110,7 +100,7 @@
         ints = Introspector(TestClass)
         self.assertEqual(ints.isInterface(), 0)
         request['PATH_INFO'] = (
-            '++module++zope.app.introspector.tests.test_introspector.TestClass')
+            '++module++zope.app.tests.test_introspector.TestClass')
         ints.setRequest(request)
         self.assertEqual(ints.getClass(), 'TestClass')
 
@@ -179,6 +169,9 @@
         self.assertEqual(tuple(ints.getDirectlyProvidedNames()),
                          ('zope.app.introspector.tests.test_introspector.I',
                           'zope.app.introspector.tests.test_introspector.I2'))
+        
+    def tearDown(self):
+        placelesssetup.tearDown()
 
 
 class I4(I3):
@@ -198,20 +191,25 @@
     def one(self, a): pass
     def two(self, a, b): pass
 
-class TestMarkerInterfaces(PlacefulSetup, TestCase):
+class TestMarkerInterfaces(TestCase):
 
     def setUp(self):
-        PlacefulSetup.setUp(self)
-        self.createStandardServices()
-        addConfigureService(self.rootFolder, Interfaces, LocalInterfaceService)
+        placelesssetup.setUp()
         provideInterface('zope.app.introspector.tests.test_introspector.I', I)
-        provideInterface('zope.app.introspector.tests.test_introspector.I2', I2)
-        provideInterface('zope.app.introspector.tests.test_introspector.I3', I3)
-        provideInterface('zope.app.introspector.tests.test_introspector.I4', I4)
-        provideInterface('zope.app.introspector.tests.test_introspector.M1', M1)
-        provideInterface('zope.app.introspector.tests.test_introspector.M2', M2)
-        provideInterface('zope.app.introspector.tests.test_introspector.M3', M3)
-        provideInterface('zope.app.introspector.tests.test_introspector.M4', M4)
+        provideInterface(
+            'zope.app.introspector.tests.test_introspector.I2', I2)
+        provideInterface(
+            'zope.app.introspector.tests.test_introspector.I3', I3)
+        provideInterface(
+            'zope.app.introspector.tests.test_introspector.I4', I4)
+        provideInterface(
+            'zope.app.introspector.tests.test_introspector.M1', M1)
+        provideInterface(
+            'zope.app.introspector.tests.test_introspector.M2', M2)
+        provideInterface(
+            'zope.app.introspector.tests.test_introspector.M3', M3)
+        provideInterface(
+            'zope.app.introspector.tests.test_introspector.M4', M4)
 
     def test_getMarkerInterfaces(self):
         ints = Introspector(Content())
@@ -231,6 +229,10 @@
     def test_getDirectMarkers(self):
         ints = Introspector(Content())
         self.assertEqual(ints.getDirectMarkersOf(I3), (M3,))
+
+    def tearDown(self):
+        placelesssetup.tearDown()
+        
 
 def test_suite():
     suite = TestSuite()


=== Zope3/src/zope/app/introspector/tests/test_introspectorview.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/introspector/tests/test_introspectorview.py:1.1	Mon Mar  1 05:18:21 2004
+++ Zope3/src/zope/app/introspector/tests/test_introspectorview.py	Fri Mar  5 10:54:39 2004
@@ -15,33 +15,27 @@
 
 $Id$
 """
-import unittest
-
-from zope.interface import Interface, directlyProvidedBy
-from zope.interface import directlyProvides, implements
-from zope.publisher.browser import TestRequest
 
+import unittest
 from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.app.services.interface import LocalInterfaceService
-from zope.app.services.servicenames import Interfaces
+from zope.publisher.browser import TestRequest
 from zope.app.tests import setup
-from zope.app.component.globalinterfaceservice import provideInterface
+from zope.interface import Interface, directlyProvidedBy
+from zope.interface import directlyProvides, implements
+from zope.app.component.interface import provideInterface
 from zope.app.tests import ztapi
-
-from zope.app.introspector import Introspector
-from zope.app.introspector.browser import IntrospectorView
 from zope.app.introspector.interfaces import IIntrospector
-
+from zope.app.introspector import Introspector
 
 class I1(Interface):
     pass
 
-id = 'zope.app.introspector.tests.test_introspector.I1'
+id = 'zope.app.introspector.tests.test_introspectorview.I1'
 
 class I2(Interface):
     pass
 
-id2 = 'zope.app.introspector.tests.test_introspector.I2'
+id2 = 'zope.app.introspector.tests.test_introspectorview.I2'
 
 class TestIntrospectorView(PlacefulSetup, unittest.TestCase):
 
@@ -49,26 +43,28 @@
         PlacefulSetup.setUp(self)
         self.rootFolder = setup.buildSampleFolderTree()
         mgr = setup.createServiceManager(self.rootFolder)
-        service = setup.addService(mgr, Interfaces, LocalInterfaceService())
-
         provideInterface(id, I1)
         provideInterface(id2, I2)
         ztapi.provideAdapter(None, IIntrospector, Introspector)
 
 
     def test_getInterfaceURL(self):
+        from zope.app.introspector.browser import IntrospectorView
+
         request = TestRequest()
         view = IntrospectorView(self.rootFolder, request)
 
         self.assertEqual(
             view.getInterfaceURL(id),
-            'http://127.0.0.1/++etc++site/default/Interfaces/detail.html?id=%s'
+            'http://127.0.0.1/++etc++site/detail.html?id=%s'
             % id)
 
         self.assertEqual(view.getInterfaceURL('zope.app.INonexistent'),
                          '')
 
     def test_update(self):
+        from zope.app.introspector.browser import IntrospectorView
+
         class Context:
             implements(Interface)
 




More information about the Zope3-Checkins mailing list