Mercurial > public > mercurial-scm > hg
comparison tests/test-ui-color.py @ 36336:236596a67a54
py3: add b'' to test-ui-color.py
# skip-blame because just b'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D2359
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 21 Feb 2018 00:24:44 +0530 |
parents | b4cb86ab4c71 |
children | 0f36926b2651 |
comparison
equal
deleted
inserted
replaced
36335:d639f60c8eb3 | 36336:236596a67a54 |
---|---|
7 ) | 7 ) |
8 | 8 |
9 # ensure errors aren't buffered | 9 # ensure errors aren't buffered |
10 testui = uimod.ui() | 10 testui = uimod.ui() |
11 testui.pushbuffer() | 11 testui.pushbuffer() |
12 testui.write(('buffered\n')) | 12 testui.write((b'buffered\n')) |
13 testui.warn(('warning\n')) | 13 testui.warn((b'warning\n')) |
14 testui.write_err('error\n') | 14 testui.write_err(b'error\n') |
15 print(repr(testui.popbuffer())) | 15 print(repr(testui.popbuffer())) |
16 | 16 |
17 # test dispatch.dispatch with the same ui object | 17 # test dispatch.dispatch with the same ui object |
18 hgrc = open(os.environ["HGRCPATH"], 'w') | 18 hgrc = open(os.environ["HGRCPATH"], 'w') |
19 hgrc.write('[extensions]\n') | 19 hgrc.write(b'[extensions]\n') |
20 hgrc.write('color=\n') | 20 hgrc.write(b'color=\n') |
21 hgrc.close() | 21 hgrc.close() |
22 | 22 |
23 ui_ = uimod.ui.load() | 23 ui_ = uimod.ui.load() |
24 ui_.setconfig('ui', 'formatted', 'True') | 24 ui_.setconfig(b'ui', b'formatted', b'True') |
25 | 25 |
26 # we're not interested in the output, so write that to devnull | 26 # we're not interested in the output, so write that to devnull |
27 ui_.fout = open(os.devnull, 'w') | 27 ui_.fout = open(os.devnull, 'w') |
28 | 28 |
29 # call some arbitrary command just so we go through | 29 # call some arbitrary command just so we go through |
30 # color's wrapped _runcommand twice. | 30 # color's wrapped _runcommand twice. |
31 def runcmd(): | 31 def runcmd(): |
32 dispatch.dispatch(dispatch.request(['version', '-q'], ui_)) | 32 dispatch.dispatch(dispatch.request([b'version', b'-q'], ui_)) |
33 | 33 |
34 runcmd() | 34 runcmd() |
35 print("colored? %s" % (ui_._colormode is not None)) | 35 print("colored? %s" % (ui_._colormode is not None)) |
36 runcmd() | 36 runcmd() |
37 print("colored? %s" % (ui_._colormode is not None)) | 37 print("colored? %s" % (ui_._colormode is not None)) |