Merge branch 'master' into 2.0
This commit is contained in:
13
setup.py
13
setup.py
@@ -1,3 +1,4 @@
|
||||
from __future__ import print_function
|
||||
import platform
|
||||
import os
|
||||
import sys
|
||||
@@ -62,11 +63,11 @@ class DocCommand(Command):
|
||||
except subprocess.CalledProcessError as exc:
|
||||
raise RuntimeError("Documentation step '%s' failed: %s: %s" % (mode, exc, exc.output))
|
||||
else:
|
||||
print output
|
||||
print(output)
|
||||
|
||||
print ""
|
||||
print "Documentation step '%s' performed, results here:" % mode
|
||||
print " %s/" % path
|
||||
print("")
|
||||
print("Documentation step '%s' performed, results here:" % mode)
|
||||
print(" %s/" % path)
|
||||
|
||||
|
||||
class BuildFailed(Exception):
|
||||
@@ -148,7 +149,7 @@ def run_setup(extensions):
|
||||
kw['cmdclass']['build_ext'] = build_extensions
|
||||
kw['ext_modules'] = extensions
|
||||
|
||||
dependencies = ['futures', 'scales', 'blist']
|
||||
dependencies = ['futures', 'scales', 'blist', 'six']
|
||||
if platform.python_implementation() != "CPython":
|
||||
dependencies.remove('blist')
|
||||
|
||||
@@ -163,7 +164,7 @@ def run_setup(extensions):
|
||||
packages=['cassandra', 'cassandra.io'],
|
||||
include_package_data=True,
|
||||
install_requires=dependencies,
|
||||
tests_require=['nose', 'mock', 'ccm', 'unittest2', 'PyYAML'],
|
||||
tests_require=['nose', 'mock', 'PyYAML'],
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Intended Audience :: Developers',
|
||||
|
@@ -1,4 +1,7 @@
|
||||
import Queue
|
||||
try:
|
||||
from Queue import Queue, Empty
|
||||
except ImportError:
|
||||
from queue import Queue, Empty
|
||||
from struct import pack
|
||||
import unittest
|
||||
|
||||
@@ -38,14 +41,14 @@ class LargeDataTests(unittest.TestCase):
|
||||
return session
|
||||
|
||||
def batch_futures(self, session, statement_generator):
|
||||
futures = Queue.Queue(maxsize=121)
|
||||
futures = Queue(maxsize=121)
|
||||
for i, statement in enumerate(statement_generator):
|
||||
if i > 0 and i % 120 == 0:
|
||||
# clear the existing queue
|
||||
while True:
|
||||
try:
|
||||
futures.get_nowait().result()
|
||||
except Queue.Empty:
|
||||
except Empty:
|
||||
break
|
||||
|
||||
future = session.execute_async(statement)
|
||||
@@ -54,7 +57,7 @@ class LargeDataTests(unittest.TestCase):
|
||||
while True:
|
||||
try:
|
||||
futures.get_nowait().result()
|
||||
except Queue.Empty:
|
||||
except Empty:
|
||||
break
|
||||
|
||||
def test_wide_rows(self):
|
||||
|
@@ -1,3 +1,4 @@
|
||||
from __future__ import print_function
|
||||
import logging
|
||||
import time
|
||||
|
||||
@@ -77,7 +78,7 @@ def force_stop(node):
|
||||
|
||||
|
||||
def ring(node):
|
||||
print 'From node%s:' % node
|
||||
print('From node%s:' % node)
|
||||
get_node(node).nodetool('ring')
|
||||
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import six
|
||||
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
except ImportError:
|
||||
@@ -295,7 +297,7 @@ class TestCodeCoverage(unittest.TestCase):
|
||||
cluster = Cluster()
|
||||
cluster.connect()
|
||||
|
||||
self.assertIsInstance(cluster.metadata.export_schema_as_string(), basestring)
|
||||
self.assertIsInstance(cluster.metadata.export_schema_as_string(), six.string_types)
|
||||
|
||||
def test_export_keyspace_schema(self):
|
||||
"""
|
||||
@@ -307,8 +309,8 @@ class TestCodeCoverage(unittest.TestCase):
|
||||
|
||||
for keyspace in cluster.metadata.keyspaces:
|
||||
keyspace_metadata = cluster.metadata.keyspaces[keyspace]
|
||||
self.assertIsInstance(keyspace_metadata.export_as_string(), basestring)
|
||||
self.assertIsInstance(keyspace_metadata.as_cql_query(), basestring)
|
||||
self.assertIsInstance(keyspace_metadata.export_as_string(), six.string_types)
|
||||
self.assertIsInstance(keyspace_metadata.as_cql_query(), six.string_types)
|
||||
|
||||
def test_case_sensitivity(self):
|
||||
"""
|
||||
|
@@ -349,7 +349,7 @@ class TypeTests(unittest.TestCase):
|
||||
""" Ensure timezone-aware datetimes are converted to timestamps correctly """
|
||||
try:
|
||||
import pytz
|
||||
except ImportError, exc:
|
||||
except ImportError as exc:
|
||||
raise unittest.SkipTest('pytz is not available: %r' % (exc,))
|
||||
|
||||
dt = datetime(1997, 8, 29, 11, 14)
|
||||
|
@@ -5,7 +5,10 @@ except ImportError:
|
||||
|
||||
import errno
|
||||
import os
|
||||
from StringIO import StringIO
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
import socket
|
||||
from socket import error as socket_error
|
||||
|
||||
|
@@ -5,7 +5,10 @@ except ImportError:
|
||||
|
||||
import errno
|
||||
import os
|
||||
from StringIO import StringIO
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
from socket import error as socket_error
|
||||
|
||||
from mock import patch, Mock
|
||||
|
@@ -3,7 +3,10 @@ try:
|
||||
except ImportError:
|
||||
import unittest # noqa
|
||||
|
||||
from StringIO import StringIO
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
|
||||
from mock import Mock, ANY
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import six
|
||||
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
except ImportError:
|
||||
@@ -8,6 +10,9 @@ from cassandra.query import PreparedStatement, BoundStatement
|
||||
from cassandra.cqltypes import Int32Type
|
||||
from cassandra.util import OrderedDict
|
||||
|
||||
if six.PY3:
|
||||
xrange = range
|
||||
|
||||
|
||||
class ParamBindingTest(unittest.TestCase):
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import six
|
||||
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
except ImportError:
|
||||
@@ -22,6 +24,9 @@ from cassandra.policies import (RoundRobinPolicy, DCAwareRoundRobinPolicy,
|
||||
from cassandra.pool import Host
|
||||
from cassandra.query import Statement
|
||||
|
||||
if six.PY3:
|
||||
xrange = range
|
||||
|
||||
|
||||
class TestLoadBalancingPolicy(unittest.TestCase):
|
||||
def test_non_implemented(self):
|
||||
|
Reference in New Issue
Block a user