Skip to content

Commit

Permalink
[py2py3] setup_test.py compatible with both py2 and py3
Browse files Browse the repository at this point in the history
  • Loading branch information
mapellidario committed May 21, 2021
1 parent e62fe1b commit defcf33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion setup_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import print_function

from builtins import str as newstr, bytes as newbytes

import atexit
import hashlib
import os
Expand Down Expand Up @@ -203,7 +205,7 @@ def callNose(self, args, paths):
print("Failed to collect TestCase IDs")
return retval

idhandle = open(".noseids", "r")
idhandle = open(".noseids", "rb")
testIds = pickle.load(idhandle)['ids']
idhandle.close()

Expand All @@ -223,6 +225,8 @@ def callNose(self, args, paths):
print('%s needs own slice' % testIds[testID][1])
continue
testName = "%s%s" % (testIds[testID][1], testIds[testID][2])
if isinstance(testName, newstr):
testName = testName.encode("utf-8")
testHash = hashlib.md5(testName).hexdigest()
hashSnip = testHash[:7]
hashInt = int(hashSnip, 16)
Expand Down

0 comments on commit defcf33

Please sign in to comment.