Changing tests to be cross python compatible
This commit is contained in:
@@ -22,6 +22,8 @@ from cassandra.query import tuple_factory
|
||||
from cassandra.cluster import Cluster
|
||||
from tests.integration import use_singledc, PROTOCOL_VERSION, execute_until_pass
|
||||
from tests.integration.datatype_utils import update_datatypes, PRIMITIVE_DATATYPES, get_sample
|
||||
from six import binary_type
|
||||
|
||||
import uuid
|
||||
|
||||
|
||||
@@ -74,7 +76,7 @@ class CustomProtocolHandlerTest(unittest.TestCase):
|
||||
result_set = session.execute("SELECT schema_version FROM system.local")
|
||||
result = result_set.pop()
|
||||
raw_value = result.pop()
|
||||
self.assertEqual(type(raw_value), str)
|
||||
self.assertTrue(isinstance(raw_value, binary_type))
|
||||
self.assertEqual(len(raw_value), 16)
|
||||
|
||||
# Ensure that we get normal uuid back when we re-connect
|
||||
|
@@ -86,14 +86,14 @@ class TimedCallableInvoker(threading.Thread):
|
||||
def __init__(self, handler, slowdown=False):
|
||||
super(TimedCallableInvoker, self).__init__()
|
||||
self.slowdown = slowdown
|
||||
self._stop = threading.Event()
|
||||
self._stopper = threading.Event()
|
||||
self.handler = handler
|
||||
|
||||
def stop(self):
|
||||
self._stop.set()
|
||||
self._stopper.set()
|
||||
|
||||
def stopped(self):
|
||||
return self._stop.isSet()
|
||||
return self._stopper.isSet()
|
||||
|
||||
def run(self):
|
||||
while(not self.stopped()):
|
||||
@@ -101,11 +101,11 @@ class TimedCallableInvoker(threading.Thread):
|
||||
pending_callback = self.handler.get_next_callback()
|
||||
priority_num = pending_callback[0]
|
||||
if (priority_num % 10) == 0 and self.slowdown:
|
||||
self._stop.wait(.1)
|
||||
self._stopper.wait(.1)
|
||||
callback_args = pending_callback[1]
|
||||
fn, args, kwargs, time_added = callback_args
|
||||
fn(time_added, *args, **kwargs)
|
||||
self._stop.wait(.001)
|
||||
self._stopper.wait(.001)
|
||||
return
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user