[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/tests - testDefaultTraverser.py:1.1.2.3 testZopePublication.py:1.1.2.13
Jim Fulton
jim@cvs.zope.org
Tue, 19 Feb 2002 11:05:40 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/tests
In directory cvs.zope.org:/tmp/cvs-serv7148/lib/python/Zope/App/ZopePublication/tests
Modified Files:
Tag: Zope-3x-branch
testDefaultTraverser.py testZopePublication.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/ZopePublication/tests/testDefaultTraverser.py 1.1.2.2 => 1.1.2.3 ===
import unittest, sys
from Zope.ComponentArchitecture.tests.Request import Request
-from Zope.ComponentArchitecture import provideView, _clear
+from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
+from Zope.ComponentArchitecture import provideView
from Zope.App.ZopePublication.Traversers import DefaultTraverser
from Interface import Interface
from Zope.Exceptions import NotFoundError
@@ -52,13 +53,7 @@
-class Test(unittest.TestCase):
-
-
- def tearDown(self):
-
- _clear()
-
+class Test(CleanUp, unittest.TestCase):
def testAttr(self):
""" test container traver """
=== Zope3/lib/python/Zope/App/ZopePublication/tests/testZopePublication.py 1.1.2.12 => 1.1.2.13 ===
from Interface import verify, instancesOfObjectImplements, Interface
-from Zope.ComponentArchitecture import provideView, setDefaultViewName, _clear
+from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
+from Zope.ComponentArchitecture import provideView, setDefaultViewName
from Zope.App.Security.PrincipalRegistry import principalRegistry
@@ -63,7 +64,7 @@
return self._context
-class BasePublicationTests(unittest.TestCase):
+class BasePublicationTests(CleanUp, unittest.TestCase):
klass = ZopePublication
def setUp(self):
@@ -86,14 +87,10 @@
get_transaction().commit()
connection.close()
- principalRegistry._clear()
- principalRoleManager._clear()
def tearDown(self):
setSecurityPolicy(self.policy)
- principalRegistry._clear()
- principalRoleManager._clear()
- _clear()
+ CleanUp.tearDown(self)
def testInterfacesVerify(self):
for interface in instancesOfObjectImplements(self.klass):