Commit 6df487c7 authored by Jim Fulton's avatar Jim Fulton

Addressed various windows test issues.

parent 151e859a
......@@ -343,6 +343,8 @@ __test__ = dict(
>>> logger.setLevel(logging.NOTSET)
>>> logger.removeHandler(handler)
>>> cache.close()
"""
)
......
......@@ -146,7 +146,7 @@ revision as well as the entire directory:
Clean up our blob directory and database:
>>> shutil.rmtree(blob_dir)
>>> rmtree(blob_dir)
>>> base_storage.close()
>>> os.unlink(storagefile)
>>> os.unlink(storagefile+".index")
......@@ -273,4 +273,4 @@ knowledge that the underlying storage's pack method is also called:
Clean up our blob directory:
>>> shutil.rmtree(blob_dir)
>>> rmtree(blob_dir)
......@@ -364,6 +364,5 @@ We don't need the storage directory and databases anymore::
>>> tm1.abort()
>>> tm2.abort()
>>> database.close()
>>> import shutil
>>> shutil.rmtree(blob_dir)
>>> shutil.rmtree(blob_dir2)
>>> rmtree(blob_dir)
>>> rmtree(blob_dir2)
......@@ -12,9 +12,9 @@
#
##############################################################################
import base64, os, shutil, tempfile, unittest
import base64, os, re, shutil, stat, sys, tempfile, unittest
import time
from zope.testing import doctest
from zope.testing import doctest, renormalizing
import ZODB.tests.util
from StringIO import StringIO
......@@ -474,6 +474,11 @@ def secure_blob_directory():
"""
# On windows, we can't create secure blob directories, at least not
# with APIs in the standard library, so there's no point in testing
# this.
if sys.platform == 'win32':
del secure_blob_directory
def loadblob_tmpstore():
"""
......@@ -521,13 +526,27 @@ def loadblob_tmpstore():
>>> database.close()
>>> import shutil
>>> shutil.rmtree(blob_dir)
>>> rmtree(blob_dir)
>>> os.unlink(storagefile)
>>> os.unlink(storagefile+".index")
>>> os.unlink(storagefile+".tmp")
"""
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)
test.globs['rmtree'] = rmtree
def test_suite():
suite = unittest.TestSuite()
......@@ -536,12 +555,16 @@ def test_suite():
"blob_basic.txt", "blob_connection.txt", "blob_transaction.txt",
"blob_packing.txt", "blob_importexport.txt", "blob_consume.txt",
"blob_tempdir.txt",
setUp=ZODB.tests.util.setUp,
setUp=setUp,
tearDown=ZODB.tests.util.tearDown,
))
suite.addTest(doctest.DocTestSuite(
setUp=ZODB.tests.util.setUp,
setUp=setUp,
tearDown=ZODB.tests.util.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)), '/'),
]),
))
suite.addTest(unittest.makeSuite(BlobUndoTests))
......
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