[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/tests/test Use setupstack, rather than the older and duplicative facilities

Jim Fulton jim at zope.com
Sat Oct 25 20:36:25 EDT 2008


Log message for revision 92562:
  Use setupstack, rather than the older and duplicative facilities
  that were removed from ZODB.tests.util.
  

Changed:
  U   ZODB/trunk/src/ZODB/tests/testFileStorage.py
  U   ZODB/trunk/src/ZODB/tests/testblob.py
  U   ZODB/trunk/src/ZODB/tests/testconflictresolution.py

-=-
Modified: ZODB/trunk/src/ZODB/tests/testFileStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testFileStorage.py	2008-10-26 00:36:22 UTC (rev 92561)
+++ ZODB/trunk/src/ZODB/tests/testFileStorage.py	2008-10-26 00:36:24 UTC (rev 92562)
@@ -15,6 +15,7 @@
 import transaction
 import ZODB.FileStorage
 import ZODB.tests.util
+import zope.testing.setupstack
 from ZODB import POSException
 from ZODB import DB
 
@@ -564,8 +565,9 @@
                   FileStorageRecoveryTest, FileStorageNoRestoreRecoveryTest,
                   SlowFileStorageTest]:
         suite.addTest(unittest.makeSuite(klass, "check"))
-    suite.addTest(doctest.DocTestSuite(setUp=ZODB.tests.util.setUp,
-                                       tearDown=ZODB.tests.util.tearDown))
+    suite.addTest(doctest.DocTestSuite(
+        setUp=zope.testing.setupstack.setUpDirectory,
+        tearDown=zope.testing.setupstack.tearDown))
     return suite
 
 if __name__=='__main__':

Modified: ZODB/trunk/src/ZODB/tests/testblob.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testblob.py	2008-10-26 00:36:22 UTC (rev 92561)
+++ ZODB/trunk/src/ZODB/tests/testblob.py	2008-10-26 00:36:24 UTC (rev 92562)
@@ -614,20 +614,9 @@
     """
 
 def setUp(test):
-    ZODB.tests.util.setUp(test)
-    def rmtree(path):
-        for path, dirs, files in os.walk(path, False):
-            for fname in files:
-                fname = os.path.join(path, fname)
-                os.chmod(fname, stat.S_IWUSR)
-                os.remove(fname)
-            for dname in dirs:
-                dname = os.path.join(path, dname)
-                os.rmdir(dname)
-        os.rmdir(path)
+    zope.testing.setupstack.setUpDirectory(test)
+    test.globs['rmtree'] = zope.testing.setupstack.rmtree
 
-    test.globs['rmtree'] = rmtree
-
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(ZODBBlobConfigTest))
@@ -636,11 +625,11 @@
         "blob_packing.txt", "blob_importexport.txt", "blob_consume.txt",
         "blob_tempdir.txt",
         setUp=setUp,
-        tearDown=ZODB.tests.util.tearDown,
+        tearDown=zope.testing.setupstack.tearDown,
         ))
     suite.addTest(doctest.DocTestSuite(
         setUp=setUp,
-        tearDown=ZODB.tests.util.tearDown,
+        tearDown=zope.testing.setupstack.tearDown,
         checker = renormalizing.RENormalizing([
             (re.compile(r'\%(sep)s\%(sep)s' % dict(sep=os.path.sep)), '/'),
             (re.compile(r'\%(sep)s' % dict(sep=os.path.sep)), '/'),

Modified: ZODB/trunk/src/ZODB/tests/testconflictresolution.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testconflictresolution.py	2008-10-26 00:36:22 UTC (rev 92561)
+++ ZODB/trunk/src/ZODB/tests/testconflictresolution.py	2008-10-26 00:36:24 UTC (rev 92562)
@@ -15,16 +15,18 @@
 $Id$
 """
 import unittest
-from zope.testing import doctest, module
+from zope.testing import doctest, module, setupstack
 
 def setUp(test):
     module.setUp(test, 'ConflictResolution_txt')
+    setupstack.setUpDirectory(test)
 
 def tearDown(test):
     test.globs['db'].close()
     test.globs['db1'].close()
     test.globs['db2'].close()
     module.tearDown(test)
+    setupstack.tearDown(test)
 
 def test_suite():
     return unittest.TestSuite((



More information about the Zodb-checkins mailing list