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
|
# make the GIL switch after every instruction, maximizing
|
||||||
# the chace of race conditions
|
# the chace of race conditions
|
||||||
if six.PY2:
|
check = six.PY2 or '__pypy__' in sys.builtin_module_names
|
||||||
|
if check:
|
||||||
original_interval = sys.getcheckinterval()
|
original_interval = sys.getcheckinterval()
|
||||||
else:
|
else:
|
||||||
original_interval = sys.getswitchinterval()
|
original_interval = sys.getswitchinterval()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if six.PY2:
|
if check:
|
||||||
sys.setcheckinterval(0)
|
sys.setcheckinterval(0)
|
||||||
else:
|
else:
|
||||||
sys.setswitchinterval(0.0001)
|
sys.setswitchinterval(0.0001)
|
||||||
map(lambda t: t.start(), threads)
|
map(lambda t: t.start(), threads)
|
||||||
map(lambda t: t.join(), threads)
|
map(lambda t: t.join(), threads)
|
||||||
finally:
|
finally:
|
||||||
if six.PY2:
|
if check:
|
||||||
sys.setcheckinterval(original_interval)
|
sys.setcheckinterval(original_interval)
|
||||||
else:
|
else:
|
||||||
sys.setswitchinterval(original_interval)
|
sys.setswitchinterval(original_interval)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ except ImportError:
|
|||||||
|
|
||||||
from binascii import unhexlify
|
from binascii import unhexlify
|
||||||
import datetime
|
import datetime
|
||||||
|
import six
|
||||||
import time
|
import time
|
||||||
import cassandra
|
import cassandra
|
||||||
from cassandra.cqltypes import (BooleanType, lookup_casstype_simple, lookup_casstype,
|
from cassandra.cqltypes import (BooleanType, lookup_casstype_simple, lookup_casstype,
|
||||||
@@ -146,7 +147,7 @@ class TypeTests(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def apply_parameters(cls, subtypes, names):
|
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):
|
class BarType(FooType):
|
||||||
typename = 'org.apache.cassandra.db.marshal.BarType'
|
typename = 'org.apache.cassandra.db.marshal.BarType'
|
||||||
|
|||||||
Reference in New Issue
Block a user