Mercurial > public > mercurial-scm > hg
comparison tests/test-ui-color.py @ 37925:b8c2004a8d2b
tests: port test-ui-color.py to Python 3
As in some other tests, I like confirming that we're dealing with
bytes here, so the b prefix is now in the expected output on both 2
and 3.
Differential Revision: https://phab.mercurial-scm.org/D3512
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 27 Apr 2018 11:59:21 -0400 |
parents | 0f36926b2651 |
children | 32bc3815efae |
comparison
equal
deleted
inserted
replaced
37924:32106c474086 | 37925:b8c2004a8d2b |
---|---|
2 | 2 |
3 import os | 3 import os |
4 from mercurial import ( | 4 from mercurial import ( |
5 dispatch, | 5 dispatch, |
6 ui as uimod, | 6 ui as uimod, |
7 ) | |
8 from mercurial.utils import ( | |
9 stringutil, | |
7 ) | 10 ) |
8 | 11 |
9 # ensure errors aren't buffered | 12 # ensure errors aren't buffered |
10 testui = uimod.ui() | 13 testui = uimod.ui() |
11 testui.pushbuffer() | 14 testui.pushbuffer() |
12 testui.write((b'buffered\n')) | 15 testui.write((b'buffered\n')) |
13 testui.warn((b'warning\n')) | 16 testui.warn((b'warning\n')) |
14 testui.write_err(b'error\n') | 17 testui.write_err(b'error\n') |
15 print(repr(testui.popbuffer())) | 18 print(stringutil.pprint(testui.popbuffer()).decode('ascii')) |
16 | 19 |
17 # test dispatch.dispatch with the same ui object | 20 # test dispatch.dispatch with the same ui object |
18 hgrc = open(os.environ["HGRCPATH"], 'wb') | 21 hgrc = open(os.environ["HGRCPATH"], 'wb') |
19 hgrc.write(b'[extensions]\n') | 22 hgrc.write(b'[extensions]\n') |
20 hgrc.write(b'color=\n') | 23 hgrc.write(b'color=\n') |
33 | 36 |
34 runcmd() | 37 runcmd() |
35 print("colored? %s" % (ui_._colormode is not None)) | 38 print("colored? %s" % (ui_._colormode is not None)) |
36 runcmd() | 39 runcmd() |
37 print("colored? %s" % (ui_._colormode is not None)) | 40 print("colored? %s" % (ui_._colormode is not None)) |
38 |