# HG changeset patch # User Yuya Nishihara # Date 2018-03-04 20:26:26 # Node ID a22915edc279b1c1de1e2cd3eb327b31748a7ee7 # Parent 389b950f5190d1b0815ab278a05d88be144a0147 py3: byte-stringify test-config.t and test-config-env.py diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -48,6 +48,8 @@ test-commit-amend.t 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 diff --git a/tests/test-config-env.py b/tests/test-config-env.py --- a/tests/test-config-env.py +++ b/tests/test-config-env.py @@ -11,24 +11,24 @@ from mercurial import ( 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 @@ def printconfigs(env): 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'}) diff --git a/tests/test-config.t b/tests/test-config.t --- a/tests/test-config.t +++ b/tests/test-config.t @@ -88,7 +88,7 @@ Test empty config source: $ cat < 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 <> .hg/hgrc