changeset 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 32106c474086
children fb6226c15e54
files contrib/python3-whitelist tests/test-ui-color.py tests/test-ui-color.py.out
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/python3-whitelist	Fri Apr 27 11:57:15 2018 -0400
+++ b/contrib/python3-whitelist	Fri Apr 27 11:59:21 2018 -0400
@@ -450,6 +450,7 @@
 test-tags.t
 test-template-engine.t
 test-treemanifest.t
+test-ui-color.py
 test-unamend.t
 test-uncommit.t
 test-unified-test.t
--- a/tests/test-ui-color.py	Fri Apr 27 11:57:15 2018 -0400
+++ b/tests/test-ui-color.py	Fri Apr 27 11:59:21 2018 -0400
@@ -5,6 +5,9 @@
     dispatch,
     ui as uimod,
 )
+from mercurial.utils import (
+    stringutil,
+)
 
 # ensure errors aren't buffered
 testui = uimod.ui()
@@ -12,7 +15,7 @@
 testui.write((b'buffered\n'))
 testui.warn((b'warning\n'))
 testui.write_err(b'error\n')
-print(repr(testui.popbuffer()))
+print(stringutil.pprint(testui.popbuffer()).decode('ascii'))
 
 # test dispatch.dispatch with the same ui object
 hgrc = open(os.environ["HGRCPATH"], 'wb')
@@ -35,4 +38,3 @@
 print("colored? %s" % (ui_._colormode is not None))
 runcmd()
 print("colored? %s" % (ui_._colormode is not None))
-
--- a/tests/test-ui-color.py.out	Fri Apr 27 11:57:15 2018 -0400
+++ b/tests/test-ui-color.py.out	Fri Apr 27 11:59:21 2018 -0400
@@ -1,5 +1,5 @@
 warning
 error
-'buffered\n'
+b'buffered\n'
 colored? True
 colored? True