changeset 41323:abac73eedd4d

tests: use bytes for file I/O Otherwise we get various type mismatches. Differential Revision: https://phab.mercurial-scm.org/D5655
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 22 Jan 2019 18:24:52 -0800
parents 4ef28d7e22ae
children 3d685ddf6b64
files tests/test-remotefilelog-histpack.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-remotefilelog-histpack.py	Tue Jan 22 18:23:47 2019 -0800
+++ b/tests/test-remotefilelog-histpack.py	Tue Jan 22 18:24:52 2019 -0800
@@ -232,12 +232,12 @@
 
     def testBadVersionThrows(self):
         pack = self.createPack()
-        path = pack.path + '.histpack'
-        with open(path) as f:
+        path = pack.path + b'.histpack'
+        with open(path, 'rb') as f:
             raw = f.read()
         raw = struct.pack('!B', 255) + raw[1:]
         os.chmod(path, os.stat(path).st_mode | stat.S_IWRITE)
-        with open(path, 'w+') as f:
+        with open(path, 'wb+') as f:
             f.write(raw)
 
         try: