[Python-checkins] cpython (merge 3.4 -> default): Fixed bytes warnings when run tests with -vv.

serhiy.storchaka python-checkins at python.org
Wed Mar 25 00:35:03 CET 2015


https://hg.python.org/cpython/rev/43c2a09a7c7a
changeset:   95187:43c2a09a7c7a
parent:      95185:7384db2fce8a
parent:      95186:8355c375df47
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Mar 25 01:34:03 2015 +0200
summary:
  Fixed bytes warnings when run tests with -vv.

files:
  Lib/test/test_cmd_line_script.py               |  10 +++++-----
  Lib/test/test_multiprocessing_main_handling.py |   2 +-
  2 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -114,7 +114,7 @@
                              expected_loader):
         if verbose > 1:
             print("Output from test script %r:" % script_name)
-            print(data)
+            print(repr(data))
         self.assertEqual(exit_code, 0)
         printed_loader = '__loader__==%a' % expected_loader
         printed_file = '__file__==%a' % expected_file
@@ -153,7 +153,7 @@
         rc, out, err = assert_python_failure(*run_args)
         if verbose > 1:
             print('Output from test script %r:' % script_name)
-            print(err)
+            print(repr(err))
             print('Expected output: %r' % expected_msg)
         self.assertIn(expected_msg.encode('utf-8'), err)
 
@@ -362,7 +362,7 @@
                 script_name = _make_test_script(pkg_dir, 'script')
                 rc, out, err = assert_python_ok('-m', 'test_pkg.script', *example_args, __isolated=False)
                 if verbose > 1:
-                    print(out)
+                    print(repr(out))
                 expected = "init_argv0==%r" % '-m'
                 self.assertIn(expected.encode('utf-8'), out)
                 self._check_output(script_name, rc, out,
@@ -380,7 +380,7 @@
                         'import sys; print("sys.path[0]==%r" % sys.path[0])',
                         __isolated=False)
                     if verbose > 1:
-                        print(out)
+                        print(repr(out))
                     expected = "sys.path[0]==%r" % ''
                     self.assertIn(expected.encode('utf-8'), out)
 
@@ -410,7 +410,7 @@
                                                 "if __name__ == '__main__': raise ValueError")
                 rc, out, err = assert_python_failure('-m', 'test_pkg.other', *example_args)
                 if verbose > 1:
-                    print(out)
+                    print(repr(out))
                 self.assertEqual(rc, 1)
 
     def test_pep_409_verbiage(self):
diff --git a/Lib/test/test_multiprocessing_main_handling.py b/Lib/test/test_multiprocessing_main_handling.py
--- a/Lib/test/test_multiprocessing_main_handling.py
+++ b/Lib/test/test_multiprocessing_main_handling.py
@@ -143,7 +143,7 @@
     def _check_output(self, script_name, exit_code, out, err):
         if verbose > 1:
             print("Output from test script %r:" % script_name)
-            print(out)
+            print(repr(out))
         self.assertEqual(exit_code, 0)
         self.assertEqual(err.decode('utf-8'), '')
         expected_results = "%s -> [1, 4, 9]" % self.start_method

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


More information about the Python-checkins mailing list