tests: avoid implicit conversion of str to unicode
authorManuel Jacob <me@manueljacob.de>
Thu, 05 Mar 2020 18:10:19 +0100
changeset 44446 109322cd322a
parent 44445 336ec75ed1ac
child 44447 fc70291f3d24
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.
tests/run-tests.py
--- a/tests/run-tests.py	Tue Feb 18 19:11:13 2020 +0100
+++ b/tests/run-tests.py	Thu Mar 05 18:10:19 2020 +0100
@@ -1428,7 +1428,7 @@
             )
             hgrc.write(b'[web]\n')
             hgrc.write(b'address = localhost\n')
-            hgrc.write(b'ipv6 = %s\n' % str(self._useipv6).encode('ascii'))
+            hgrc.write(b'ipv6 = %r\n' % self._useipv6)
             hgrc.write(b'server-header = testing stub value\n')
 
             for opt in self._extraconfigopts: