[PATCH 3 of 4] run-tests: pass unicode to Pygments

Yuya Nishihara yuya at tcha.org
Thu Aug 24 11:20:42 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1503580802 -32400
#      Thu Aug 24 22:20:02 2017 +0900
# Node ID a9b6c464c13b6a6d7dce4e8adf88d0e80dc96003
# Parent  7b0eeb08d182eec00c79fe4617c09c1ec12bcbc5
run-tests: pass unicode to Pygments

This is required on Python 3, and is more correct on Python 2 because
Pygments is a unicode library.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -615,7 +615,8 @@ def highlightdiff(line, color):
     if not color:
         return line
     assert pygmentspresent
-    return pygments.highlight(line, difflexer, terminal256formatter)
+    return pygments.highlight(line.decode('latin1'), difflexer,
+                              terminal256formatter).encode('latin1')
 
 def highlightmsg(msg, color):
     if not color:


More information about the Mercurial-devel mailing list