[Python-checkins] cpython (2.7): #17833: add debug output to investigate buildbot failure.

ezio.melotti python-checkins at python.org
Tue May 7 08:35:01 CEST 2013


http://hg.python.org/cpython/rev/63f2941477d3
changeset:   83664:63f2941477d3
branch:      2.7
parent:      83661:a285ce18bd55
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Tue May 07 09:34:49 2013 +0300
summary:
  #17833: add debug output to investigate buildbot failure.

files:
  Lib/test/test_tcl.py |  18 ++++++++++++++----
  1 files changed, 14 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -4,6 +4,7 @@
 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 @@
 
         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,)
 
-        self.assertIn('Tkinter.py', f.read())
-        # exit code must be zero
-        self.assertEqual(f.close(), None)
+            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')
+
 
     def test_passing_values(self):
         def passValue(value):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list