Bug 1414958 - Better handle Unicode in `mach python-test` draft
authorGregory Szorc <gps@mozilla.com>
Mon, 06 Nov 2017 14:31:56 -0800
changeset 693821 98d0b17e74efb0f568e12966527387a3a3539ca6
parent 693772 4ea775c267be77107929d68799628a66027f3172
child 739146 22f12c72aeb3f01de2a898cdd76b4a3d40b89626
push id87926
push userbmo:gps@mozilla.com
push dateMon, 06 Nov 2017 22:32:08 +0000
bugs1414958
milestone58.0a1
Bug 1414958 - Better handle Unicode in `mach python-test` I suspect this will yield a failure in self.log() on line 199. But I want to make sure before I ask for review. MozReview-Commit-ID: FSvS7r9wL4q
python/mach_commands.py
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -203,18 +203,18 @@ class MachCommands(MachCommandBase):
         def _line_handler(line):
             if not file_displayed_test:
                 output = ('Ran' in line or 'collected' in line or
                           line.startswith('TEST-'))
                 if output:
                     file_displayed_test.append(True)
 
             # Hack to make sure treeherder highlights pytest failures
-            if 'FAILED' in line.rsplit(' ', 1)[-1]:
-                line = line.replace('FAILED', 'TEST-UNEXPECTED-FAIL')
+            if b'FAILED' in line.rsplit(b' ', 1)[-1]:
+                line = line.replace(b'FAILED', b'TEST-UNEXPECTED-FAIL')
 
             _log(line)
 
         _log(test_path)
         cmd = [self.virtualenv_manager.python_path, test_path]
         env = os.environ.copy()
         env[b'PYTHONDONTWRITEBYTECODE'] = b'1'