D5793: tests: convert ParseError arguments to str on Python 3

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Feb 1 13:15:24 EST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc4a90ea32914: tests: convert ParseError arguments to str on Python 3 (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5793?vs=13670&id=13671

REVISION DETAIL
  https://phab.mercurial-scm.org/D5793

AFFECTED FILES
  tests/test-trusted.py

CHANGE DETAILS

diff --git a/tests/test-trusted.py b/tests/test-trusted.py
--- a/tests/test-trusted.py
+++ b/tests/test-trusted.py
@@ -222,15 +222,25 @@
 f.write(b'foo')
 f.close()
 
+# This is a hack to remove b'' prefixes from ParseError.__bytes__ on
+# Python 3.
+def normalizeparseerror(e):
+    if pycompat.ispy3:
+        args = [a.decode('utf-8') for a in e.args]
+    else:
+        args = e.args
+
+    return error.ParseError(*args)
+
 try:
     testui(user=b'abc', group=b'def', silent=True)
 except error.ParseError as inst:
-    bprint(inst)
+    bprint(normalizeparseerror(inst))
 
 try:
     testui(debug=True, silent=True)
 except error.ParseError as inst:
-    bprint(inst)
+    bprint(normalizeparseerror(inst))
 
 print()
 bprint(b'# access typed information')



To: indygreg, #hg-reviewers
Cc: mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list