comparison tests/test-duplicateoptions.py @ 33723:5b2f331d0a33

tests: update duplicateoptions test to use bytestrings everywhere Test now passes on Python 3. Differential Revision: https://phab.mercurial-scm.org/D297
author Augie Fackler <augie@google.com>
date Tue, 25 Jul 2017 22:53:44 -0400
parents bd872f64a8ba
children 9abe91a503da
comparison
equal deleted inserted replaced
33722:62fbe95075d3 33723:5b2f331d0a33
4 commands, 4 commands,
5 extensions, 5 extensions,
6 ui as uimod, 6 ui as uimod,
7 ) 7 )
8 8
9 ignore = {'highlight', 'win32text', 'factotum'} 9 ignore = {b'highlight', b'win32text', b'factotum'}
10 10
11 if os.name != 'nt': 11 if os.name != 'nt':
12 ignore.add('win32mbcs') 12 ignore.add(b'win32mbcs')
13 13
14 disabled = [ext for ext in extensions.disabled().keys() if ext not in ignore] 14 disabled = [ext for ext in extensions.disabled().keys() if ext not in ignore]
15 15
16 hgrc = open(os.environ["HGRCPATH"], 'w') 16 hgrc = open(os.environ["HGRCPATH"], 'wb')
17 hgrc.write('[extensions]\n') 17 hgrc.write(b'[extensions]\n')
18 18
19 for ext in disabled: 19 for ext in disabled:
20 hgrc.write(ext + '=\n') 20 hgrc.write(ext + b'=\n')
21 21
22 hgrc.close() 22 hgrc.close()
23 23
24 u = uimod.ui.load() 24 u = uimod.ui.load()
25 extensions.loadall(u) 25 extensions.loadall(u)
28 globallong = set() 28 globallong = set()
29 for option in commands.globalopts: 29 for option in commands.globalopts:
30 option[0] and globalshort.add(option[0]) 30 option[0] and globalshort.add(option[0])
31 option[1] and globallong.add(option[1]) 31 option[1] and globallong.add(option[1])
32 32
33 for cmd, entry in commands.table.iteritems(): 33 for cmd, entry in commands.table.items():
34 seenshort = globalshort.copy() 34 seenshort = globalshort.copy()
35 seenlong = globallong.copy() 35 seenlong = globallong.copy()
36 for option in entry[1]: 36 for option in entry[1]:
37 if (option[0] and option[0] in seenshort) or \ 37 if (option[0] and option[0] in seenshort) or \
38 (option[1] and option[1] in seenlong): 38 (option[1] and option[1] in seenlong):