tests: use bytes for file I/O
authorGregory Szorc <gregory.szorc@gmail.com>
Tue, 22 Jan 2019 18:24:52 -0800
changeset 41323 abac73eedd4d
parent 41322 4ef28d7e22ae
child 41324 3d685ddf6b64
tests: use bytes for file I/O Otherwise we get various type mismatches. Differential Revision: https://phab.mercurial-scm.org/D5655
tests/test-remotefilelog-histpack.py
--- 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: