From 4fba5514aba1e9d29e539f205b835775ba253f27 Mon Sep 17 00:00:00 2001 From: GregBestland Date: Wed, 14 Sep 2016 14:15:06 -0500 Subject: [PATCH] Fixing various unstable tests --- tests/integration/__init__.py | 3 ++- tests/integration/standard/test_connection.py | 2 +- tests/integration/standard/test_query.py | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py index 1336002e..9dbfca3e 100644 --- a/tests/integration/__init__.py +++ b/tests/integration/__init__.py @@ -218,6 +218,7 @@ greaterthanorequalcass36 = unittest.skipUnless(CASSANDRA_VERSION >= '3.6', 'Cass lessthancass30 = unittest.skipUnless(CASSANDRA_VERSION < '3.0', 'Cassandra version less then 3.0 required') dseonly = unittest.skipUnless(DSE_VERSION, "Test is only applicalbe to DSE clusters") pypy = unittest.skipUnless(platform.python_implementation() == "PyPy", "Test is skipped unless it's on PyPy") +notpy3 = unittest.skipIf(sys.version_info >= (3, 0), "Test not applicable for Python 3.x runtime") def wait_for_node_socket(node, timeout): @@ -546,7 +547,7 @@ class BasicKeyspaceUnitTestCase(unittest.TestCase): @classmethod def common_setup(cls, rf, keyspace_creation=True, create_class_table=False, metrics=False): cls.cluster = Cluster(protocol_version=PROTOCOL_VERSION, metrics_enabled=metrics) - cls.session = cls.cluster.connect() + cls.session = cls.cluster.connect(wait_for_all_pools=True) cls.ks_name = cls.__name__.lower() if keyspace_creation: cls.create_keyspace(rf) diff --git a/tests/integration/standard/test_connection.py b/tests/integration/standard/test_connection.py index 5a4a4637..8b4b0430 100644 --- a/tests/integration/standard/test_connection.py +++ b/tests/integration/standard/test_connection.py @@ -162,7 +162,7 @@ class HeartbeatTest(unittest.TestCase): def wait_for_no_connections(self, host, cluster): retry = 0 - while(retry < 100): + while(retry < 200): retry += 1 connections = self.fetch_connections(host, cluster) if len(connections) is 0: diff --git a/tests/integration/standard/test_query.py b/tests/integration/standard/test_query.py index 94b69d22..e75506e3 100644 --- a/tests/integration/standard/test_query.py +++ b/tests/integration/standard/test_query.py @@ -26,7 +26,7 @@ from cassandra.query import (PreparedStatement, BoundStatement, SimpleStatement, from cassandra.cluster import Cluster, NoHostAvailable from cassandra.policies import HostDistance, RoundRobinPolicy from tests.unit.cython.utils import notcython -from tests.integration import use_singledc, PROTOCOL_VERSION, BasicSharedKeyspaceUnitTestCase, get_server_versions, greaterthanprotocolv3, MockLoggingHandler, get_supported_protocol_versions +from tests.integration import use_singledc, PROTOCOL_VERSION, BasicSharedKeyspaceUnitTestCase, get_server_versions, greaterthanprotocolv3, MockLoggingHandler, get_supported_protocol_versions, notpy3 import time import re @@ -71,6 +71,7 @@ class QueryTests(BasicSharedKeyspaceUnitTestCase): str(event) @notcython + @notpy3 def test_row_error_message(self): """ Test to validate, new column deserialization message @@ -483,7 +484,7 @@ class BatchStatementTests(BasicSharedKeyspaceUnitTestCase): self.cluster = Cluster(protocol_version=PROTOCOL_VERSION) if PROTOCOL_VERSION < 3: self.cluster.set_core_connections_per_host(HostDistance.LOCAL, 1) - self.session = self.cluster.connect() + self.session = self.cluster.connect(wait_for_all_pools=True) def tearDown(self): self.cluster.shutdown()