[Zope3-checkins] CVS: Zope3/src/zope/app/cache/tests - test_cachename.py:1.4
Jim Fulton
jim@zope.com
Tue, 3 Jun 2003 17:43:29 -0400
Update of /cvs-repository/Zope3/src/zope/app/cache/tests
In directory cvs.zope.org:/tmp/cvs-serv29620/src/zope/app/cache/tests
Modified Files:
test_cachename.py
Log Message:
Refactored the setup machinery for placefull tests.
Most of the setup code is now available in stand-alone functions in
zope.app.tests.setup. These include high-level functions for setting
up service managers and services.
Simplified existing tests to use the new setup facilities, removing
lots of icky code.
=== Zope3/src/zope/app/cache/tests/test_cachename.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/cache/tests/test_cachename.py:1.3 Thu May 1 15:35:06 2003
+++ Zope3/src/zope/app/cache/tests/test_cachename.py Tue Jun 3 17:42:59 2003
@@ -22,10 +22,13 @@
from zope.app.interfaces.cache.cache import CacheName
from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.app.services.tests.servicemanager import TestingServiceManager
+from zope.app.tests import setup
+from zope.app.interfaces.services.service import ILocalService
class CachingServiceStub(object):
+ __implements__ = ILocalService
+
def getAvailableCaches(self):
return 'foo', 'bar', 'baz'
@@ -33,11 +36,9 @@
class CacheNameTest(PlacefulSetup, unittest.TestCase):
def setUp(self):
- PlacefulSetup.setUp(self)
- self.buildFolders()
- sm = TestingServiceManager()
- self.rootFolder.setServiceManager(sm)
- sm.Caching = CachingServiceStub()
+ PlacefulSetup.setUp(self, folders=True)
+ sm = self.makeSite()
+ setup.addService(sm, 'Caching', CachingServiceStub())
def test(self):
field = CacheName().bind(self.rootFolder)