Commit 10303c07 authored by Tres Seaver's avatar Tres Seaver

Moar resource leak patchage.

parent 166c5b76
......@@ -234,7 +234,7 @@ class FileStorageTests(
self.open()
# Open .fs directly, and damage content.
f = open('FileStorageTests.fs', 'r+b')
with open('FileStorageTests.fs', 'r+b') as f:
f.seek(0, 2)
pos2 = f.tell() - 8
f.seek(pos2)
......@@ -247,7 +247,6 @@ class FileStorageTests(
# Now damage the second copy.
f.seek(pos2)
f.write(p64(tlen2 - 1))
f.close()
# Try to pack. This used to yield
# NameError: global name 's' is not defined
......
......@@ -71,14 +71,13 @@ class ZODBTests(ZODB.tests.util.TestCase):
assert len(ob) > 10, 'Insufficient test data'
try:
import tempfile
f = tempfile.TemporaryFile()
with tempfile.TemporaryFile(prefix="DUP") as f:
ob._p_jar.exportFile(ob._p_oid, f)
assert f.tell() > 0, 'Did not export correctly'
f.seek(0)
new_ob = ob._p_jar.importFile(f)
self.assertEqual(new_ob, ob)
root['dup'] = new_ob
f.close()
if abort_it:
transaction.abort()
else:
......
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