Fix build problems.

Fix build problems. Remove python 2.6 support. Add declare_namespace
method to module init files. Add API doc template.
This commit is contained in:
Brian Korty 2015-05-11 13:25:04 -04:00
parent b391aab881
commit e0031bfb32
7 changed files with 14 additions and 19 deletions

View file

@ -2,7 +2,6 @@ language: python
python: python:
- 2.7 - 2.7
- pypy - pypy
- 3.2
- 3.3 - 3.3
- 3.4 - 3.4
install: install:

2
docs/api.rst Normal file
View file

@ -0,0 +1,2 @@
.. automodule:: sprockets.clients.cassandra
:members:

View file

@ -1,8 +1,7 @@
import codecs import codecs
import sys import sys
from setuptools import setuptools
def read_requirements_file(req_name): def read_requirements_file(req_name):
requirements = [] requirements = []
@ -25,7 +24,7 @@ tests_require = read_requirements_file('test-requirements.txt')
setuptools.setup( setuptools.setup(
name='sprockets.clients.cassandra', name='sprockets.clients.cassandra',
version=sprockets.clients.cassandra.__version__, version='0.0.0',
description='Base functionality for accessing/modifying data in Cassandra', description='Base functionality for accessing/modifying data in Cassandra',
long_description=codecs.open('README.rst', encoding='utf-8').read(), long_description=codecs.open('README.rst', encoding='utf-8').read(),
url='https://github.com/sprockets/sprockets.clients.cassandra.git', url='https://github.com/sprockets/sprockets.clients.cassandra.git',

View file

@ -1,3 +1 @@
# -*- coding: utf-8 -*- __import__('pkg_resources').declare_namespace(__name__)
version_info = (0, 0, 0)
__version__ = '.'.join(str(v) for v in version_info[:3])

View file

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View file

@ -19,13 +19,13 @@ class TestCassandraConnectionClass(AsyncTestCase):
super(TestCassandraConnectionClass, self).setUp() super(TestCassandraConnectionClass, self).setUp()
self.cluster = Cluster(self.find_cassandra()) self.cluster = Cluster(self.find_cassandra())
self.session = self.cluster.connect() self.session = self.cluster.connect()
self.keyspace = 'sprocketstest{}'.format(int(time.time()*10000)) self.keyspace = 'sprocketstest{0}'.format(int(time.time()*10000))
self.create_fixtures() self.create_fixtures()
self.connection = CassandraConnection(ioloop=self.io_loop) self.connection = CassandraConnection(ioloop=self.io_loop)
def tearDown(self): def tearDown(self):
super(TestCassandraConnectionClass, self).tearDown() super(TestCassandraConnectionClass, self).tearDown()
self.session.execute("DROP KEYSPACE {}".format(self.keyspace)) self.session.execute("DROP KEYSPACE {0}".format(self.keyspace))
self.connection.shutdown() self.connection.shutdown()
def find_cassandra(self): def find_cassandra(self):
@ -36,10 +36,10 @@ class TestCassandraConnectionClass(AsyncTestCase):
def create_fixtures(self): def create_fixtures(self):
self.session.execute( self.session.execute(
"CREATE KEYSPACE IF NOT EXISTS {} WITH REPLICATION = " "CREATE KEYSPACE IF NOT EXISTS {0} WITH REPLICATION = "
"{{'class': 'SimpleStrategy', " "{{'class': 'SimpleStrategy', "
"'replication_factor': 1}}".format(self.keyspace)) "'replication_factor': 1}}".format(self.keyspace))
self.session.execute("USE {}".format(self.keyspace)) self.session.execute("USE {0}".format(self.keyspace))
self.session.execute( self.session.execute(
"CREATE TABLE IF NOT EXISTS names (name text PRIMARY KEY)") "CREATE TABLE IF NOT EXISTS names (name text PRIMARY KEY)")
self.session.execute( self.session.execute(
@ -51,7 +51,7 @@ class TestCassandraConnectionClass(AsyncTestCase):
count = 100 count = 100
for i in range(count): for i in range(count):
futures.append(self.connection.execute( futures.append(self.connection.execute(
"SELECT name FROM {}.names".format(self.keyspace))) "SELECT name FROM {0}.names".format(self.keyspace)))
results = 0 results = 0
for future in futures: for future in futures:
yield future yield future

10
tox.ini
View file

@ -1,16 +1,12 @@
[tox] [tox]
envlist = py26,py27,py32,py33,py34 envlist = py27,py33,py34
[testenv] [testenv]
commands = nosetests [] commands = nosetests []
deps = -rtest-requirements.txt deps = -rrequirements.txt
-rtest-requirements.txt
[testenv:py27] [testenv:py27]
deps = deps =
mock>=1.0.1,<2.0 mock>=1.0.1,<2.0
{[testenv]deps} {[testenv]deps}
[testenv:py26]
deps =
unittest2==0.5.1
{[testenv:py27]deps}