py3: byte-stringify test-config.t and test-config-env.py
authorYuya Nishihara <yuya@tcha.org>
Sun, 04 Mar 2018 15:26:26 -0500
changeset 36730 a22915edc279
parent 36729 389b950f5190
child 36731 8988c34bd018
py3: byte-stringify test-config.t and test-config-env.py
contrib/python3-whitelist
tests/test-config-env.py
tests/test-config.t
--- a/contrib/python3-whitelist	Sun Mar 04 15:24:45 2018 -0500
+++ b/contrib/python3-whitelist	Sun Mar 04 15:26:26 2018 -0500
@@ -48,6 +48,8 @@
 test-commit-unresolved.t
 test-commit.t
 test-completion.t
+test-config-env.py
+test-config.t
 test-conflict.t
 test-confused-revert.t
 test-contrib-check-code.t
--- a/tests/test-config-env.py	Sun Mar 04 15:24:45 2018 -0500
+++ b/tests/test-config-env.py	Sun Mar 04 15:26:26 2018 -0500
@@ -11,24 +11,24 @@
     util,
 )
 
-testtmp = encoding.environ['TESTTMP']
+testtmp = encoding.environ[b'TESTTMP']
 
 # prepare hgrc files
 def join(name):
     return os.path.join(testtmp, name)
 
-with open(join('sysrc'), 'w') as f:
-    f.write('[ui]\neditor=e0\n[pager]\npager=p0\n')
+with open(join(b'sysrc'), 'wb') as f:
+    f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n')
 
-with open(join('userrc'), 'w') as f:
-    f.write('[ui]\neditor=e1')
+with open(join(b'userrc'), 'wb') as f:
+    f.write(b'[ui]\neditor=e1')
 
 # replace rcpath functions so they point to the files above
 def systemrcpath():
-    return [join('sysrc')]
+    return [join(b'sysrc')]
 
 def userrcpath():
-    return [join('userrc')]
+    return [join(b'userrc')]
 
 rcutil.systemrcpath = systemrcpath
 rcutil.userrcpath = userrcpath
@@ -41,9 +41,10 @@
     ui = uimod.ui.load()
     for section, name, value in ui.walkconfig():
         source = ui.configsource(section, name)
-        print('%s.%s=%s # %s' % (section, name, value, util.pconvert(source)))
-    print('')
+        util.stdout.write(b'%s.%s=%s # %s\n'
+                          % (section, name, value, util.pconvert(source)))
+    util.stdout.write(b'\n')
 
 # environment variable overrides
 printconfigs({})
-printconfigs({'EDITOR': 'e2', 'PAGER': 'p2'})
+printconfigs({b'EDITOR': b'e2', b'PAGER': b'p2'})
--- a/tests/test-config.t	Sun Mar 04 15:24:45 2018 -0500
+++ b/tests/test-config.t	Sun Mar 04 15:26:26 2018 -0500
@@ -88,7 +88,7 @@
 
   $ cat <<EOF > emptysource.py
   > def reposetup(ui, repo):
-  >     ui.setconfig('empty', 'source', 'value')
+  >     ui.setconfig(b'empty', b'source', b'value')
   > EOF
   $ cp .hg/hgrc .hg/hgrc.orig
   $ cat <<EOF >> .hg/hgrc