##// END OF EJS Templates
py3: byte-stringify test-config.t and test-config-env.py
Yuya Nishihara -
r36748:a22915ed default
parent child Browse files
Show More
@@ -48,6 +48,8 b' test-commit-amend.t'
48 test-commit-unresolved.t
48 test-commit-unresolved.t
49 test-commit.t
49 test-commit.t
50 test-completion.t
50 test-completion.t
51 test-config-env.py
52 test-config.t
51 test-conflict.t
53 test-conflict.t
52 test-confused-revert.t
54 test-confused-revert.t
53 test-contrib-check-code.t
55 test-contrib-check-code.t
@@ -11,24 +11,24 b' from mercurial import ('
11 util,
11 util,
12 )
12 )
13
13
14 testtmp = encoding.environ['TESTTMP']
14 testtmp = encoding.environ[b'TESTTMP']
15
15
16 # prepare hgrc files
16 # prepare hgrc files
17 def join(name):
17 def join(name):
18 return os.path.join(testtmp, name)
18 return os.path.join(testtmp, name)
19
19
20 with open(join('sysrc'), 'w') as f:
20 with open(join(b'sysrc'), 'wb') as f:
21 f.write('[ui]\neditor=e0\n[pager]\npager=p0\n')
21 f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n')
22
22
23 with open(join('userrc'), 'w') as f:
23 with open(join(b'userrc'), 'wb') as f:
24 f.write('[ui]\neditor=e1')
24 f.write(b'[ui]\neditor=e1')
25
25
26 # replace rcpath functions so they point to the files above
26 # replace rcpath functions so they point to the files above
27 def systemrcpath():
27 def systemrcpath():
28 return [join('sysrc')]
28 return [join(b'sysrc')]
29
29
30 def userrcpath():
30 def userrcpath():
31 return [join('userrc')]
31 return [join(b'userrc')]
32
32
33 rcutil.systemrcpath = systemrcpath
33 rcutil.systemrcpath = systemrcpath
34 rcutil.userrcpath = userrcpath
34 rcutil.userrcpath = userrcpath
@@ -41,9 +41,10 b' def printconfigs(env):'
41 ui = uimod.ui.load()
41 ui = uimod.ui.load()
42 for section, name, value in ui.walkconfig():
42 for section, name, value in ui.walkconfig():
43 source = ui.configsource(section, name)
43 source = ui.configsource(section, name)
44 print('%s.%s=%s # %s' % (section, name, value, util.pconvert(source)))
44 util.stdout.write(b'%s.%s=%s # %s\n'
45 print('')
45 % (section, name, value, util.pconvert(source)))
46 util.stdout.write(b'\n')
46
47
47 # environment variable overrides
48 # environment variable overrides
48 printconfigs({})
49 printconfigs({})
49 printconfigs({'EDITOR': 'e2', 'PAGER': 'p2'})
50 printconfigs({b'EDITOR': b'e2', b'PAGER': b'p2'})
@@ -88,7 +88,7 b' Test empty config source:'
88
88
89 $ cat <<EOF > emptysource.py
89 $ cat <<EOF > emptysource.py
90 > def reposetup(ui, repo):
90 > def reposetup(ui, repo):
91 > ui.setconfig('empty', 'source', 'value')
91 > ui.setconfig(b'empty', b'source', b'value')
92 > EOF
92 > EOF
93 $ cp .hg/hgrc .hg/hgrc.orig
93 $ cp .hg/hgrc .hg/hgrc.orig
94 $ cat <<EOF >> .hg/hgrc
94 $ cat <<EOF >> .hg/hgrc
General Comments 0
You need to be logged in to leave comments. Login now