From 63af8010bb07cf12370d4b6ea08094358219b66a Mon Sep 17 00:00:00 2001 From: Adam Holmberg Date: Fri, 23 Jan 2015 17:40:46 -0600 Subject: [PATCH] Bail on some tests for python3, where static string depend on dict ordering --- setup.py | 8 ++------ tests/integration/standard/test_cluster.py | 10 ---------- tests/integration/standard/test_metadata.py | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/setup.py b/setup.py index ec7f6edd..8536755e 100644 --- a/setup.py +++ b/setup.py @@ -56,16 +56,11 @@ try: from nose.commands import nosetests except ImportError: gevent_nosetests = None + eventlet_nosetests = None else: class gevent_nosetests(nosetests): description = "run nosetests with gevent monkey patching" - -try: - from nose.commands import nosetests -except ImportError: - eventlet_nosetests = None -else: class eventlet_nosetests(nosetests): description = "run nosetests with eventlet monkey patching" @@ -188,6 +183,7 @@ On OSX, via homebrew: def run_setup(extensions): + kw = {'cmdclass': {'doc': DocCommand}} if gevent_nosetests is not None: kw['cmdclass']['gevent_nosetests'] = gevent_nosetests diff --git a/tests/integration/standard/test_cluster.py b/tests/integration/standard/test_cluster.py index 6c8b2be4..95e6082b 100644 --- a/tests/integration/standard/test_cluster.py +++ b/tests/integration/standard/test_cluster.py @@ -488,14 +488,6 @@ class ClusterTests(unittest.TestCase): self.assertIn(cluster.control_connection, holders) self.assertEqual(len(holders), 2 * len(cluster.metadata.all_hosts()) + 1) # 2 sessions' hosts pools, 1 for cc - # exclude removed sessions - session2.shutdown() - del session2 - - holders = cluster.get_connection_holders() - self.assertIn(cluster.control_connection, holders) - self.assertEqual(len(holders), len(cluster.metadata.all_hosts()) + 1) # hosts pools, 1 for cc - cluster._idle_heartbeat.stop() cluster._idle_heartbeat.join() assert_quiescent_pool_state(self, cluster) @@ -553,6 +545,4 @@ class ClusterTests(unittest.TestCase): assert_quiescent_pool_state(self, cluster) session2.shutdown() - del session2 - assert_quiescent_pool_state(self, cluster) session.shutdown() diff --git a/tests/integration/standard/test_metadata.py b/tests/integration/standard/test_metadata.py index 344e5491..1e46d3c5 100644 --- a/tests/integration/standard/test_metadata.py +++ b/tests/integration/standard/test_metadata.py @@ -11,15 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import six -import difflib try: import unittest2 as unittest except ImportError: import unittest # noqa +import difflib from mock import Mock +import six +import sys from cassandra import AlreadyExists @@ -361,6 +362,9 @@ class TestCodeCoverage(unittest.TestCase): "Protocol 3.0+ is required for UDT change events, currently testing against %r" % (PROTOCOL_VERSION,)) + if sys.version_info[2:] != (2, 7): + raise unittest.SkipTest('This test compares static strings generated from dict items, which may change orders. Test with 2.7.') + cluster = Cluster(protocol_version=PROTOCOL_VERSION) session = cluster.connect() @@ -549,6 +553,9 @@ CREATE TABLE export_udts.users ( if get_server_versions()[0] < (2, 1, 0): raise unittest.SkipTest('Test schema output assumes 2.1.0+ options') + if sys.version_info[2:] != (2, 7): + raise unittest.SkipTest('This test compares static strings generated from dict items, which may change orders. Test with 2.7.') + cli_script = """CREATE KEYSPACE legacy WITH placement_strategy = 'SimpleStrategy' AND strategy_options = {replication_factor:1}; @@ -633,7 +640,7 @@ create column family composite_comp_with_col index_type : 0}] and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor'};""" - # note: the innerlkey type for legacy.nested_composite_key + # note: the inner key type for legacy.nested_composite_key # (org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UUIDType, org.apache.cassandra.db.marshal.UTF8Type)) # is a bit strange, but it replays in CQL with desired results expected_string = """CREATE KEYSPACE legacy WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; @@ -807,6 +814,7 @@ CREATE TABLE legacy.composite_comp_no_col ( cluster.shutdown() + class TokenMetadataTest(unittest.TestCase): """ Test of TokenMap creation and other behavior. @@ -882,7 +890,7 @@ class KeyspaceAlterMetadata(unittest.TestCase): self.assertEqual(original_keyspace_meta.durable_writes, True) self.assertEqual(len(original_keyspace_meta.tables), 1) - self.session.execute('ALTER KEYSPACE %s WITH durable_writes = false' %name) + self.session.execute('ALTER KEYSPACE %s WITH durable_writes = false' % name) new_keyspace_meta = self.cluster.metadata.keyspaces[name] self.assertNotEqual(original_keyspace_meta, new_keyspace_meta) self.assertEqual(new_keyspace_meta.durable_writes, False)