Patchwork D9351: tests: use new ParseError.format() in test-trusted.py

login
register
mail settings
Submitter phabricator
Date Nov. 21, 2020, 12:26 a.m.
Message ID <differential-rev-PHID-DREV-a5vhlq2hydmgeoi73lii-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47629/
State Superseded
Headers show

Comments

phabricator - Nov. 21, 2020, 12:26 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-trusted.py
  tests/test-trusted.py.out

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-trusted.py.out b/tests/test-trusted.py.out
--- a/tests/test-trusted.py.out
+++ b/tests/test-trusted.py.out
@@ -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
diff --git a/tests/test-trusted.py b/tests/test-trusted.py
--- a/tests/test-trusted.py
+++ b/tests/test-trusted.py
@@ -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')