diff --git a/tests/unit/test_policies.py b/tests/unit/test_policies.py index bd8426cd..ba389c76 100644 --- a/tests/unit/test_policies.py +++ b/tests/unit/test_policies.py @@ -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) diff --git a/tests/unit/test_types.py b/tests/unit/test_types.py index dc43eda1..4588b856 100644 --- a/tests/unit/test_types.py +++ b/tests/unit/test_types.py @@ -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'