]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#17833: add debug output to investigate buildbot failure.
authorEzio Melotti <ezio.melotti@gmail.com>
Tue, 7 May 2013 06:34:49 +0000 (09:34 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Tue, 7 May 2013 06:34:49 +0000 (09:34 +0300)
Lib/test/test_tcl.py

index ea3d87d7b57d7b3cdb0e571cbc38cea3a0c9a4e2..a0e9e627ac6a1d2e927475995b2969f9c96db962 100644 (file)
@@ -4,6 +4,7 @@ import unittest
 import sys
 import os
 from test import test_support
+from subprocess import Popen, PIPE
 
 # Skip this test if the _tkinter module wasn't built.
 _tkinter = test_support.import_module('_tkinter')
@@ -146,11 +147,20 @@ class TclTest(unittest.TestCase):
 
         with test_support.EnvironmentVarGuard() as env:
             env.unset("TCL_LIBRARY")
-            f = os.popen('%s -c "import Tkinter; print Tkinter"' % (unc_name,))
+            cmd = '%s -c "import Tkinter; print Tkinter"' % (unc_name,)
+
+            p = Popen(cmd, stdout=PIPE, stderr=PIPE)
+            out_data, err_data = p.communicate()
+
+            msg = '\n\n'.join(['"Tkinter.py" not in output',
+                               'Command:', cmd,
+                               'stdout:', out_data,
+                               'stderr:', err_data])
+
+            self.assertIn('Tkinter.py', out_data, msg)
+
+            self.assertEqual(p.wait(), 0, 'Non-zero exit code')
 
-        self.assertIn('Tkinter.py', f.read())
-        # exit code must be zero
-        self.assertEqual(f.close(), None)
 
     def test_passing_values(self):
         def passValue(value):