Show More
@@ -40,7 +40,7 b' class datapacktestsbase(object):' | |||
|
40 | 40 | shutil.rmtree(d) |
|
41 | 41 | |
|
42 | 42 | def makeTempDir(self): |
|
43 | tempdir = tempfile.mkdtemp() | |
|
43 | tempdir = pycompat.bytestr(tempfile.mkdtemp()) | |
|
44 | 44 | self.tempdirs.append(tempdir) |
|
45 | 45 | return tempdir |
|
46 | 46 | |
@@ -48,7 +48,8 b' class datapacktestsbase(object):' | |||
|
48 | 48 | return hashlib.sha1(content).digest() |
|
49 | 49 | |
|
50 | 50 | def getFakeHash(self): |
|
51 |
return ''.join(chr(random.randint(0, 255)) |
|
|
51 | return b''.join(pycompat.bytechr(random.randint(0, 255)) | |
|
52 | for _ in range(20)) | |
|
52 | 53 | |
|
53 | 54 | def createPack(self, revisions=None, packdir=None): |
|
54 | 55 | if revisions is None: |
@@ -221,11 +222,11 b' class datapacktestsbase(object):' | |||
|
221 | 222 | def testBadVersionThrows(self): |
|
222 | 223 | pack = self.createPack() |
|
223 | 224 | path = pack.path + b'.datapack' |
|
224 | with open(path) as f: | |
|
225 | with open(path, 'rb') as f: | |
|
225 | 226 | raw = f.read() |
|
226 | 227 | raw = struct.pack('!B', 255) + raw[1:] |
|
227 | 228 | os.chmod(path, os.stat(path).st_mode | stat.S_IWRITE) |
|
228 | with open(path, 'w+') as f: | |
|
229 | with open(path, 'wb+') as f: | |
|
229 | 230 | f.write(raw) |
|
230 | 231 | |
|
231 | 232 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now