[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py
Converted tests to use new helper functions.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Apr 1 11:41:05 EST 2005
Log message for revision 29787:
Converted tests to use new helper functions.
Changed:
U Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py
-=-
Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py 2005-04-01 16:33:32 UTC (rev 29786)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py 2005-04-01 16:41:05 UTC (rev 29787)
@@ -15,33 +15,13 @@
$Id$
"""
-import sys
import zope.interface
import zope.app.folder.folder
import zope.publisher.interfaces.xmlrpc
-from zope.app.testing import ztapi, functional
+from zope.app.testing import ztapi, functional, setup
-# Evil hack to make pickling work with classes defined in doc tests
-class NoCopyDict(dict):
- def copy(self):
- return self
-
-class FakeModule:
- def __init__(self, dict):
- self.__dict = dict
- def __getattr__(self, name):
- try:
- return self.__dict[name]
- except KeyError:
- raise AttributeError, name
-
-globs = NoCopyDict()
-name = 'zope.app.publisher.xmlrpc.README'
-
-
def setUp(test):
- globs['__name__'] = name
- sys.modules[name] = FakeModule(globs)
+ setup.setUpTestAsModule(test, 'zope.app.publisher.xmlrpc.README')
def tearDown(test):
# clean up the views we registered:
@@ -64,13 +44,11 @@
None,
)
- globs.clear()
- del sys.modules[name]
+ setup.tearDownTestAsModule(test)
def test_suite():
return functional.FunctionalDocFileSuite(
- 'README.txt',
- setUp=setUp, tearDown=tearDown, globs=globs)
+ 'README.txt', setUp=setUp, tearDown=tearDown)
if __name__ == '__main__':
import unittest
More information about the Zope3-Checkins
mailing list