Make unit tests work with latest version of pypy
This commit is contained in:
@@ -140,20 +140,21 @@ class RoundRobinPolicyTest(unittest.TestCase):
|
||||
|
||||
# make the GIL switch after every instruction, maximizing
|
||||
# the chace of race conditions
|
||||
if six.PY2:
|
||||
check = six.PY2 or '__pypy__' in sys.builtin_module_names
|
||||
if check:
|
||||
original_interval = sys.getcheckinterval()
|
||||
else:
|
||||
original_interval = sys.getswitchinterval()
|
||||
|
||||
try:
|
||||
if six.PY2:
|
||||
if check:
|
||||
sys.setcheckinterval(0)
|
||||
else:
|
||||
sys.setswitchinterval(0.0001)
|
||||
map(lambda t: t.start(), threads)
|
||||
map(lambda t: t.join(), threads)
|
||||
finally:
|
||||
if six.PY2:
|
||||
if check:
|
||||
sys.setcheckinterval(original_interval)
|
||||
else:
|
||||
sys.setswitchinterval(original_interval)
|
||||
|
||||
@@ -20,6 +20,7 @@ except ImportError:
|
||||
|
||||
from binascii import unhexlify
|
||||
import datetime
|
||||
import six
|
||||
import time
|
||||
import cassandra
|
||||
from cassandra.cqltypes import (BooleanType, lookup_casstype_simple, lookup_casstype,
|
||||
@@ -146,7 +147,7 @@ class TypeTests(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def apply_parameters(cls, subtypes, names):
|
||||
return cls(subtypes, [unhexlify(name) if name is not None else name for name in names])
|
||||
return cls(subtypes, [unhexlify(six.b(name)) if name is not None else name for name in names])
|
||||
|
||||
class BarType(FooType):
|
||||
typename = 'org.apache.cassandra.db.marshal.BarType'
|
||||
|
||||
Reference in New Issue
Block a user