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