comparison tests/run-tests.py @ 44446:109322cd322a

tests: avoid implicit conversion of str to unicode On Python 2, str.encode('ascii') implicitly converts the string to unicode and then back to str. Since the point of this expression is to convert a bool to a str, the '%r' conversion specifier can be used instead in the format string.
author Manuel Jacob <me@manueljacob.de>
date Thu, 05 Mar 2020 18:10:19 +0100
parents bd0de73cf810
children fc70291f3d24
comparison
equal deleted inserted replaced
44445:336ec75ed1ac 44446:109322cd322a
1426 b'usercache = %s\n' 1426 b'usercache = %s\n'
1427 % (os.path.join(self._testtmp, b'.cache/lfs')) 1427 % (os.path.join(self._testtmp, b'.cache/lfs'))
1428 ) 1428 )
1429 hgrc.write(b'[web]\n') 1429 hgrc.write(b'[web]\n')
1430 hgrc.write(b'address = localhost\n') 1430 hgrc.write(b'address = localhost\n')
1431 hgrc.write(b'ipv6 = %s\n' % str(self._useipv6).encode('ascii')) 1431 hgrc.write(b'ipv6 = %r\n' % self._useipv6)
1432 hgrc.write(b'server-header = testing stub value\n') 1432 hgrc.write(b'server-header = testing stub value\n')
1433 1433
1434 for opt in self._extraconfigopts: 1434 for opt in self._extraconfigopts:
1435 section, key = opt.encode('utf-8').split(b'.', 1) 1435 section, key = opt.encode('utf-8').split(b'.', 1)
1436 assert b'=' in key, ( 1436 assert b'=' in key, (