]> granicus.if.org Git - python/commitdiff
Make error more explicit in test_finalize_with_trace
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 19 Sep 2010 23:28:30 +0000 (23:28 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 19 Sep 2010 23:28:30 +0000 (23:28 +0000)
Lib/test/test_threading.py

index 39c5a17231becf9794c7b5ed40a4a3da3a6fd369..19ba7301430784327e2cbbdac3a62b2ed1882d79 100644 (file)
@@ -304,7 +304,7 @@ class ThreadTests(BaseTestCase):
         # Issue1733757
         # Avoid a deadlock when sys.settrace steps into threading._shutdown
         import subprocess
-        rc = subprocess.call([sys.executable, "-c", """if 1:
+        p = subprocess.Popen([sys.executable, "-c", """if 1:
             import sys, threading
 
             # A deadlock-killer, to prevent the
@@ -324,9 +324,14 @@ class ThreadTests(BaseTestCase):
                 return func
 
             sys.settrace(func)
-            """])
+            """],
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE)
+        stdout, stderr = p.communicate()
+        rc = p.returncode
         self.assertFalse(rc == 2, "interpreted was blocked")
-        self.assertTrue(rc == 0, "Unexpected error")
+        self.assertTrue(rc == 0,
+                        "Unexpected error: " + ascii(stderr))
 
     def test_join_nondaemon_on_shutdown(self):
         # Issue 1722344