Skip to content

Commit 20a844f

Browse files
committed
Make sure to close temporary file after use.
1 parent 9cd2166 commit 20a844f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

couchdb/tests/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ def test_attachment_from_fs(self):
306306
f.close()
307307
doc = {}
308308
self.db['foo'] = doc
309-
self.db.put_attachment(doc, open(tmpfile))
309+
with open(tmpfile) as f:
310+
self.db.put_attachment(doc, f)
310311
doc = self.db.get('foo')
311312
self.assertTrue(doc['_attachments']['test.txt']['content_type'] == 'text/plain')
312313
shutil.rmtree(tmpdir)

0 commit comments

Comments
 (0)