]> granicus.if.org Git - python/commitdiff
Fix transient refleak in test_popen2.
authorFlorent Xicluna <florent.xicluna@gmail.com>
Thu, 4 Mar 2010 15:57:20 +0000 (15:57 +0000)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Thu, 4 Mar 2010 15:57:20 +0000 (15:57 +0000)
Lib/test/test_popen2.py

index 1383c6276c74d26ad70676a518d8c611ee99d2cf..715858e431caf2cb7d3404ab6a668cd503feea1d 100644 (file)
@@ -50,7 +50,13 @@ class Popen2Test(unittest.TestCase):
         for inst in popen2._active:
             inst.wait()
         popen2._cleanup()
-        self.assertFalse(popen2._active, "_active not empty")
+        self.assertFalse(popen2._active, "popen2._active not empty")
+        # The os.popen*() API delegates to the subprocess module (on Unix)
+        import subprocess
+        for inst in subprocess._active:
+            inst.wait()
+        subprocess._cleanup()
+        self.assertFalse(subprocess._active, "subprocess._active not empty")
         reap_children()
 
     def validate_output(self, teststr, expected_out, r, w, e=None):