Show More
@@ -1,38 +1,38 b'' | |||
|
1 | 1 | from __future__ import absolute_import, print_function |
|
2 | 2 | |
|
3 | 3 | import os |
|
4 | 4 | from mercurial import ( |
|
5 | 5 | dispatch, |
|
6 | 6 | ui as uimod, |
|
7 | 7 | ) |
|
8 | 8 | |
|
9 | 9 | # ensure errors aren't buffered |
|
10 | 10 | testui = uimod.ui() |
|
11 | 11 | testui.pushbuffer() |
|
12 | testui.write(('buffered\n')) | |
|
13 | testui.warn(('warning\n')) | |
|
14 | testui.write_err('error\n') | |
|
12 | testui.write((b'buffered\n')) | |
|
13 | testui.warn((b'warning\n')) | |
|
14 | testui.write_err(b'error\n') | |
|
15 | 15 | print(repr(testui.popbuffer())) |
|
16 | 16 | |
|
17 | 17 | # test dispatch.dispatch with the same ui object |
|
18 | 18 | hgrc = open(os.environ["HGRCPATH"], 'w') |
|
19 | hgrc.write('[extensions]\n') | |
|
20 | hgrc.write('color=\n') | |
|
19 | hgrc.write(b'[extensions]\n') | |
|
20 | hgrc.write(b'color=\n') | |
|
21 | 21 | hgrc.close() |
|
22 | 22 | |
|
23 | 23 | ui_ = uimod.ui.load() |
|
24 | ui_.setconfig('ui', 'formatted', 'True') | |
|
24 | ui_.setconfig(b'ui', b'formatted', b'True') | |
|
25 | 25 | |
|
26 | 26 | # we're not interested in the output, so write that to devnull |
|
27 | 27 | ui_.fout = open(os.devnull, 'w') |
|
28 | 28 | |
|
29 | 29 | # call some arbitrary command just so we go through |
|
30 | 30 | # color's wrapped _runcommand twice. |
|
31 | 31 | def runcmd(): |
|
32 | dispatch.dispatch(dispatch.request(['version', '-q'], ui_)) | |
|
32 | dispatch.dispatch(dispatch.request([b'version', b'-q'], ui_)) | |
|
33 | 33 | |
|
34 | 34 | runcmd() |
|
35 | 35 | print("colored? %s" % (ui_._colormode is not None)) |
|
36 | 36 | runcmd() |
|
37 | 37 | print("colored? %s" % (ui_._colormode is not None)) |
|
38 | 38 |
General Comments 0
You need to be logged in to leave comments.
Login now