From 9248b6d2b61e862b31805a264399fc1696b50f8c Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 23 Jan 2019 12:44:08 +0000 Subject: [PATCH] issue #477: old Py zlib did not include extended exception text. --- tests/first_stage_test.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/first_stage_test.py b/tests/first_stage_test.py index feaa34ce..470afc7a 100644 --- a/tests/first_stage_test.py +++ b/tests/first_stage_test.py @@ -30,15 +30,18 @@ class CommandLineTest(testlib.RouterMixin, testlib.TestCase): # success. fp = open("/dev/null", "r") - proc = subprocess.Popen(args, - stdin=fp, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - ) - stdout, stderr = proc.communicate() - self.assertEquals(0, proc.returncode) - self.assertEquals(mitogen.parent.Stream.EC0_MARKER, stdout) - self.assertIn(b("Error -5 while decompressing data: incomplete or truncated stream"), stderr) + try: + proc = subprocess.Popen(args, + stdin=fp, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + stdout, stderr = proc.communicate() + self.assertEquals(0, proc.returncode) + self.assertEquals(mitogen.parent.Stream.EC0_MARKER, stdout) + self.assertIn(b("Error -5 while decompressing data"), stderr) + finally: + fp.close() if __name__ == '__main__':