comparison tests/test-ui-color.py @ 28682:2e5be704bc96

py3: make test-ui-color use print_function
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 29 Mar 2016 16:41:32 +0530
parents ff1586a3adc5
children 40afa22bee9b
comparison
equal deleted inserted replaced
28681:eda8b28e3b1b 28682:2e5be704bc96
1 from __future__ import print_function
1 import os 2 import os
2 from hgext import color 3 from hgext import color
3 from mercurial import dispatch, ui 4 from mercurial import dispatch, ui
4 5
5 # ensure errors aren't buffered 6 # ensure errors aren't buffered
6 testui = color.colorui() 7 testui = color.colorui()
7 testui.pushbuffer() 8 testui.pushbuffer()
8 testui.write(('buffered\n')) 9 testui.write(('buffered\n'))
9 testui.warn(('warning\n')) 10 testui.warn(('warning\n'))
10 testui.write_err('error\n') 11 testui.write_err('error\n')
11 print repr(testui.popbuffer()) 12 print(repr(testui.popbuffer()))
12 13
13 # test dispatch.dispatch with the same ui object 14 # test dispatch.dispatch with the same ui object
14 hgrc = open(os.environ["HGRCPATH"], 'w') 15 hgrc = open(os.environ["HGRCPATH"], 'w')
15 hgrc.write('[extensions]\n') 16 hgrc.write('[extensions]\n')
16 hgrc.write('color=\n') 17 hgrc.write('color=\n')
26 # color's wrapped _runcommand twice. 27 # color's wrapped _runcommand twice.
27 def runcmd(): 28 def runcmd():
28 dispatch.dispatch(dispatch.request(['version', '-q'], ui_)) 29 dispatch.dispatch(dispatch.request(['version', '-q'], ui_))
29 30
30 runcmd() 31 runcmd()
31 print "colored? " + str(issubclass(ui_.__class__, color.colorui)) 32 print("colored? " + str(issubclass(ui_.__class__, color.colorui)))
32 runcmd() 33 runcmd()
33 print "colored? " + str(issubclass(ui_.__class__, color.colorui)) 34 print("colored? " + str(issubclass(ui_.__class__, color.colorui)))