changeset 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 336ec75ed1ac
children fc70291f3d24
files tests/run-tests.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: