tests/test-remotefilelog-datapack.py
changeset 41473 90b3898cf0db
parent 41472 6309ce86fa82
child 41474 e971952db109
--- a/tests/test-remotefilelog-datapack.py	Wed Jan 30 13:22:42 2019 -0800
+++ b/tests/test-remotefilelog-datapack.py	Wed Jan 30 13:30:01 2019 -0800
@@ -40,7 +40,7 @@
             shutil.rmtree(d)
 
     def makeTempDir(self):
-        tempdir = tempfile.mkdtemp()
+        tempdir = pycompat.bytestr(tempfile.mkdtemp())
         self.tempdirs.append(tempdir)
         return tempdir
 
@@ -48,7 +48,8 @@
         return hashlib.sha1(content).digest()
 
     def getFakeHash(self):
-        return ''.join(chr(random.randint(0, 255)) for _ in range(20))
+        return b''.join(pycompat.bytechr(random.randint(0, 255))
+                        for _ in range(20))
 
     def createPack(self, revisions=None, packdir=None):
         if revisions is None:
@@ -221,11 +222,11 @@
     def testBadVersionThrows(self):
         pack = self.createPack()
         path = pack.path + b'.datapack'
-        with open(path) as f:
+        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: