From 7301981f32e32417a5f808598ec128f1a34f8d14 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Mon, 31 Mar 2014 08:25:35 -0700 Subject: [PATCH] test_writeorg: Close a tempfile --HG-- branch : test_writeorg_close_tempfile --- testing/test_capture.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/test_capture.py b/testing/test_capture.py index fe28f56bb..2c026220f 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -747,8 +747,9 @@ class TestFDCapture: f = cap.done() scap = f.read() assert scap == totext(data1) - stmp = open(tmpfile.name, 'rb').read() - assert stmp == data2 + with open(tmpfile.name, 'rb') as stmp_file: + stmp = stmp_file.read() + assert stmp == data2 class TestStdCapture: