Commit 87d6cb2d authored by Christian Theune's avatar Christian Theune

- fixed leakages of file handles

parent d755aeb1
...@@ -159,3 +159,8 @@ modifying the ZODB_BLOB_TEMPDIR environment variable: ...@@ -159,3 +159,8 @@ modifying the ZODB_BLOB_TEMPDIR environment variable:
1 1
>>> shutil.rmtree(tempdir) >>> shutil.rmtree(tempdir)
>>> del os.environ['ZODB_BLOB_TEMPDIR'] >>> del os.environ['ZODB_BLOB_TEMPDIR']
Some cleanup in this test is needed:
>>> import transaction
>>> transaction.get().abort()
...@@ -85,11 +85,18 @@ Make sure our data exists: ...@@ -85,11 +85,18 @@ Make sure our data exists:
True True
>>> items1['blob2'].open().read() == items2['blob2'].open().read() >>> items1['blob2'].open().read() == items2['blob2'].open().read()
True True
>>> transaction.get().abort()
Clean up our blob directory: Clean up our blob directory:
>>> base_storage1.close()
>>> base_storage2.close()
>>> shutil.rmtree(blob_dir1) >>> shutil.rmtree(blob_dir1)
>>> shutil.rmtree(blob_dir2) >>> shutil.rmtree(blob_dir2)
>>> os.unlink(exportfile) >>> os.unlink(exportfile)
>>> os.unlink(storagefile1) >>> os.unlink(storagefile1)
>>> os.unlink(storagefile1+".index")
>>> os.unlink(storagefile1+".tmp")
>>> os.unlink(storagefile2) >>> os.unlink(storagefile2)
>>> os.unlink(storagefile2+".index")
>>> os.unlink(storagefile2+".tmp")
...@@ -30,7 +30,6 @@ Set up: ...@@ -30,7 +30,6 @@ Set up:
>>> storagefile = mktemp() >>> storagefile = mktemp()
>>> blob_dir = mkdtemp() >>> blob_dir = mkdtemp()
UNDOING UNDOING
======= =======
...@@ -149,7 +148,11 @@ revision as well as the entire directory: ...@@ -149,7 +148,11 @@ revision as well as the entire directory:
Clean up our blob directory and database: Clean up our blob directory and database:
>>> shutil.rmtree(blob_dir) >>> shutil.rmtree(blob_dir)
>>> base_storage.close()
>>> os.unlink(storagefile) >>> os.unlink(storagefile)
>>> os.unlink(storagefile+".index")
>>> os.unlink(storagefile+".tmp")
>>> os.unlink(storagefile+".old")
NON-UNDOING NON-UNDOING
=========== ===========
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# #
############################################################################## ##############################################################################
import tempfile, shutil, unittest import tempfile, shutil, unittest
import os
from ZODB.tests.testConfig import ConfigTestBase from ZODB.tests.testConfig import ConfigTestBase
from ZConfig import ConfigurationSyntaxError from ZConfig import ConfigurationSyntaxError
...@@ -55,8 +56,11 @@ class ZODBBlobConfigTest(BlobConfigTestBase): ...@@ -55,8 +56,11 @@ class ZODBBlobConfigTest(BlobConfigTestBase):
</blobstorage> </blobstorage>
</zodb> </zodb>
""" %(self.blob_dir, path)) """ %(self.blob_dir, path))
os.unlink(path)
os.unlink(path+".index")
os.unlink(path+".tmp")
def test_blod_dir_needed(self): def test_blob_dir_needed(self):
self.assertRaises(ConfigurationSyntaxError, self.assertRaises(ConfigurationSyntaxError,
self._test, self._test,
""" """
......
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