changeset 45888:c9b14c56fc2b

tests: use new ParseError.format() in test-trusted.py Differential Revision: https://phab.mercurial-scm.org/D9351
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 20 Nov 2020 10:22:58 -0800
parents 7eb221b9af6c
children e5a0efd26f7a
files tests/test-trusted.py tests/test-trusted.py.out
diffstat 2 files changed, 4 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-trusted.py	Thu Nov 19 15:13:39 2020 -0800
+++ b/tests/test-trusted.py	Fri Nov 20 10:22:58 2020 -0800
@@ -254,26 +254,15 @@
 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(normalizeparseerror(inst))
+    bprint(inst.format())
 
 try:
     testui(debug=True, silent=True)
 except error.ParseError as inst:
-    bprint(normalizeparseerror(inst))
+    bprint(inst.format())
 
 print()
 bprint(b'# access typed information')
--- a/tests/test-trusted.py.out	Thu Nov 19 15:13:39 2020 -0800
+++ b/tests/test-trusted.py.out	Fri Nov 20 10:22:58 2020 -0800
@@ -176,7 +176,8 @@
 not trusting file .hg/hgrc from untrusted user abc, group def
 ignored: ('foo', '.hg/hgrc:1')
 # same user, same group
-ParseError('foo', '.hg/hgrc:1')
+hg: parse error at .hg/hgrc:1: foo
+
 
 # access typed information
 # different user, different group