##// END OF EJS Templates
tests: convert ParseError arguments to str on Python 3...
Gregory Szorc -
r41544:c4a90ea3 default draft
parent child Browse files
Show More
@@ -222,15 +222,25 b" f = open(b'.hg/hgrc', 'wb')"
222 f.write(b'foo')
222 f.write(b'foo')
223 f.close()
223 f.close()
224
224
225 # This is a hack to remove b'' prefixes from ParseError.__bytes__ on
226 # Python 3.
227 def normalizeparseerror(e):
228 if pycompat.ispy3:
229 args = [a.decode('utf-8') for a in e.args]
230 else:
231 args = e.args
232
233 return error.ParseError(*args)
234
225 try:
235 try:
226 testui(user=b'abc', group=b'def', silent=True)
236 testui(user=b'abc', group=b'def', silent=True)
227 except error.ParseError as inst:
237 except error.ParseError as inst:
228 bprint(inst)
238 bprint(normalizeparseerror(inst))
229
239
230 try:
240 try:
231 testui(debug=True, silent=True)
241 testui(debug=True, silent=True)
232 except error.ParseError as inst:
242 except error.ParseError as inst:
233 bprint(inst)
243 bprint(normalizeparseerror(inst))
234
244
235 print()
245 print()
236 bprint(b'# access typed information')
246 bprint(b'# access typed information')
General Comments 0
You need to be logged in to leave comments. Login now