Mercurial > public > mercurial-scm > hg-stable
diff tests/test-config-env.py @ 36753:a22915edc279
py3: byte-stringify test-config.t and test-config-env.py
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 04 Mar 2018 15:26:26 -0500 |
parents | 08fbc97d1364 |
children | d4a2e0d5d042 |
line wrap: on
line diff
--- 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'})