Patchwork tests: use native string type for parsed hghave log lines

login
register
mail settings
Submitter Manuel Jacob
Date March 9, 2020, 4:28 a.m.
Message ID <0fda94caf796adac51a1.1583728136@tmp.fritz.box>
Download mbox | patch
Permalink /patch/45625/
State Accepted
Headers show

Comments

Manuel Jacob - March 9, 2020, 4:28 a.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1583727542 -3600
#      Mon Mar 09 05:19:02 2020 +0100
# Node ID 0fda94caf796adac51a105ae2f39c057b37cf183
# Parent  1320093a99dc1a1ed796b230dd2f1b87ea045eac
# EXP-Topic remove-implicit-str-conversions
tests: use native string type for parsed hghave log lines

Before this change, on Python 2, the parsed messages were decoded to unicode,
causing an implicit conversion from unicode to str later.
Yuya Nishihara - March 9, 2020, 1:46 p.m.
On Mon, 09 Mar 2020 05:28:56 +0100, Manuel Jacob wrote:
> # HG changeset patch
> # User Manuel Jacob <me@manueljacob.de>
> # Date 1583727542 -3600
> #      Mon Mar 09 05:19:02 2020 +0100
> # Node ID 0fda94caf796adac51a105ae2f39c057b37cf183
> # Parent  1320093a99dc1a1ed796b230dd2f1b87ea045eac
> # EXP-Topic remove-implicit-str-conversions
> tests: use native string type for parsed hghave log lines

Queued, thanks.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2070,12 +2070,10 @@ 
         for line in lines:
             if line.startswith(TTest.SKIPPED_PREFIX):
                 line = line.splitlines()[0]
-                missing.append(
-                    line[len(TTest.SKIPPED_PREFIX) :].decode('utf-8')
-                )
+                missing.append(_bytes2sys(line[len(TTest.SKIPPED_PREFIX) :]))
             elif line.startswith(TTest.FAILED_PREFIX):
                 line = line.splitlines()[0]
-                failed.append(line[len(TTest.FAILED_PREFIX) :].decode('utf-8'))
+                failed.append(_bytes2sys(line[len(TTest.FAILED_PREFIX) :]))
 
         return missing, failed