From 0c04b449196bca5bd9ea565b17e118845824f6e3 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 2 Apr 2014 12:32:21 +0200 Subject: [PATCH] fix issue492: avoid leak in test_writeorg --- CHANGELOG | 2 ++ testing/test_capture.py | 12 +++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 190dd4b51..956d6d367 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -40,6 +40,8 @@ NEXT (2.6) - improvements to pytest's own test-suite leakage detection, courtesy of PRs from Marc Abramowitz +- fix issue492: avoid leak in test_writeorg + 2.5.2 ----------------------------------- diff --git a/testing/test_capture.py b/testing/test_capture.py index 4b8e25001..2fceea50e 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -709,13 +709,11 @@ class TestFDCapture: def test_writeorg(self, tmpfile): data1, data2 = tobytes("foo"), tobytes("bar") - try: - cap = capture.FDCapture(tmpfile.fileno()) - cap.start() - tmpfile.write(data1) - cap.writeorg(data2) - finally: - tmpfile.close() + cap = capture.FDCapture(tmpfile.fileno()) + cap.start() + tmpfile.write(data1) + tmpfile.flush() + cap.writeorg(data2) scap = cap.snap() cap.done() assert scap == totext(data1)