]> granicus.if.org Git - python/commitdiff
Close subprocess pipes to clean up ResourceWarnings
authorBrian Curtin <brian.curtin@gmail.com>
Fri, 5 Nov 2010 17:22:46 +0000 (17:22 +0000)
committerBrian Curtin <brian.curtin@gmail.com>
Fri, 5 Nov 2010 17:22:46 +0000 (17:22 +0000)
Lib/test/test_threading.py

index 784f95be9ef4290e49ec07b1d4f380045055c6e2..b2a58810ed94b86cef054f304c8e644e7456bb37 100644 (file)
@@ -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: <built-in function sleep>")