[Python-checkins] cpython: Issue #11393: check that stdout is empty if we use a file

victor.stinner python-checkins at python.org
Thu Mar 31 18:16:41 CEST 2011


http://hg.python.org/cpython/rev/e91de993964c
changeset:   69083:e91de993964c
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Thu Mar 31 18:15:52 2011 +0200
summary:
  Issue #11393: check that stdout is empty if we use a file

files:
  Lib/test/test_faulthandler.py |  11 ++++++++---
  1 files changed, 8 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -53,12 +53,13 @@
         process = script_helper.spawn_python('-c', code, **options)
         stdout, stderr = process.communicate()
         exitcode = process.wait()
+        output = support.strip_python_stderr(stdout)
+        output = output.decode('ascii', 'backslashreplace')
         if filename:
+            self.assertEqual(output, '')
             with open(filename, "rb") as fp:
                 output = fp.read()
-        else:
-            output = support.strip_python_stderr(stdout)
-        output = output.decode('ascii', 'backslashreplace')
+            output = output.decode('ascii', 'backslashreplace')
         output = re.sub('Current thread 0x[0-9a-f]+',
                         'Current thread XXX',
                         output)
@@ -262,6 +263,8 @@
 
     def test_dump_traceback(self):
         self.check_dump_traceback(None)
+
+    def test_dump_traceback_file(self):
         with temporary_filename() as filename:
             self.check_dump_traceback(filename)
 
@@ -327,6 +330,8 @@
 
     def test_dump_traceback_threads(self):
         self.check_dump_traceback_threads(None)
+
+    def test_dump_traceback_threads_file(self):
         with temporary_filename() as filename:
             self.check_dump_traceback_threads(filename)
 

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


More information about the Python-checkins mailing list