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)