Commit fe7e5e3b authored by Jim Fulton's avatar Jim Fulton

Use setupstack, rather than the older and duplicative facilities

that were removed from ZODB.tests.util.
parent 7a31b87b
...@@ -15,6 +15,7 @@ import os, unittest ...@@ -15,6 +15,7 @@ import os, unittest
import transaction import transaction
import ZODB.FileStorage import ZODB.FileStorage
import ZODB.tests.util import ZODB.tests.util
import zope.testing.setupstack
from ZODB import POSException from ZODB import POSException
from ZODB import DB from ZODB import DB
...@@ -564,8 +565,9 @@ def test_suite(): ...@@ -564,8 +565,9 @@ def test_suite():
FileStorageRecoveryTest, FileStorageNoRestoreRecoveryTest, FileStorageRecoveryTest, FileStorageNoRestoreRecoveryTest,
SlowFileStorageTest]: SlowFileStorageTest]:
suite.addTest(unittest.makeSuite(klass, "check")) suite.addTest(unittest.makeSuite(klass, "check"))
suite.addTest(doctest.DocTestSuite(setUp=ZODB.tests.util.setUp, suite.addTest(doctest.DocTestSuite(
tearDown=ZODB.tests.util.tearDown)) setUp=zope.testing.setupstack.setUpDirectory,
tearDown=zope.testing.setupstack.tearDown))
return suite return suite
if __name__=='__main__': if __name__=='__main__':
......
...@@ -614,19 +614,8 @@ def is_blob_record(): ...@@ -614,19 +614,8 @@ def is_blob_record():
""" """
def setUp(test): def setUp(test):
ZODB.tests.util.setUp(test) zope.testing.setupstack.setUpDirectory(test)
def rmtree(path): test.globs['rmtree'] = zope.testing.setupstack.rmtree
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)
test.globs['rmtree'] = rmtree
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
...@@ -636,11 +625,11 @@ def test_suite(): ...@@ -636,11 +625,11 @@ def test_suite():
"blob_packing.txt", "blob_importexport.txt", "blob_consume.txt", "blob_packing.txt", "blob_importexport.txt", "blob_consume.txt",
"blob_tempdir.txt", "blob_tempdir.txt",
setUp=setUp, setUp=setUp,
tearDown=ZODB.tests.util.tearDown, tearDown=zope.testing.setupstack.tearDown,
)) ))
suite.addTest(doctest.DocTestSuite( suite.addTest(doctest.DocTestSuite(
setUp=setUp, setUp=setUp,
tearDown=ZODB.tests.util.tearDown, tearDown=zope.testing.setupstack.tearDown,
checker = renormalizing.RENormalizing([ checker = renormalizing.RENormalizing([
(re.compile(r'\%(sep)s\%(sep)s' % dict(sep=os.path.sep)), '/'), (re.compile(r'\%(sep)s\%(sep)s' % dict(sep=os.path.sep)), '/'),
(re.compile(r'\%(sep)s' % dict(sep=os.path.sep)), '/'), (re.compile(r'\%(sep)s' % dict(sep=os.path.sep)), '/'),
......
...@@ -15,16 +15,18 @@ ...@@ -15,16 +15,18 @@
$Id$ $Id$
""" """
import unittest import unittest
from zope.testing import doctest, module from zope.testing import doctest, module, setupstack
def setUp(test): def setUp(test):
module.setUp(test, 'ConflictResolution_txt') module.setUp(test, 'ConflictResolution_txt')
setupstack.setUpDirectory(test)
def tearDown(test): def tearDown(test):
test.globs['db'].close() test.globs['db'].close()
test.globs['db1'].close() test.globs['db1'].close()
test.globs['db2'].close() test.globs['db2'].close()
module.tearDown(test) module.tearDown(test)
setupstack.tearDown(test)
def test_suite(): def test_suite():
return unittest.TestSuite(( return unittest.TestSuite((
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment