From: Brian Curtin Date: Fri, 5 Nov 2010 17:22:46 +0000 (+0000) Subject: Close subprocess pipes to clean up ResourceWarnings X-Git-Tag: v3.2a4~131 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de11b189d1e771053fa3e662b2b08116998a73bc;p=python Close subprocess pipes to clean up ResourceWarnings --- diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 784f95be9e..b2a58810ed 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -327,6 +327,8 @@ class ThreadTests(BaseTestCase): """], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) stdout, stderr = p.communicate() rc = p.returncode self.assertFalse(rc == 2, "interpreted was blocked") @@ -352,6 +354,8 @@ class ThreadTests(BaseTestCase): """], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.addCleanup(p.stdout.close) + self.addCleanup(p.stderr.close) stdout, stderr = p.communicate() self.assertEqual(stdout.strip(), b"Woke up, sleep function is: ")