From: Ezio Melotti Date: Tue, 7 May 2013 06:34:49 +0000 (+0300) Subject: #17833: add debug output to investigate buildbot failure. X-Git-Tag: v2.7.5~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=794e5573f42a3632aba75a2bff9150db4e0bb8ab;p=thirdparty%2FPython%2Fcpython.git #17833: add debug output to investigate buildbot failure. --- diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index ea3d87d7b57d..a0e9e627ac6a 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -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):