tests/test-trusted.py
changeset 41497 3028b4073be1
parent 41352 73ccba60aaa1
child 43076 2372284d9457
equal deleted inserted replaced
41496:e095a9688a31 41497:3028b4073be1
   220 bprint(b"# parse error")
   220 bprint(b"# parse error")
   221 f = open(b'.hg/hgrc', 'wb')
   221 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')
   237 with open(b'.hg/hgrc', 'wb') as f:
   247 with open(b'.hg/hgrc', 'wb') as f:
   238     f.write(b'''\
   248     f.write(b'''\