From e0031bfb32358630232649d9979a80ae7331753e Mon Sep 17 00:00:00 2001 From: Brian Korty Date: Mon, 11 May 2015 13:25:04 -0400 Subject: [PATCH] Fix build problems. Fix build problems. Remove python 2.6 support. Add declare_namespace method to module init files. Add API doc template. --- .travis.yml | 1 - docs/api.rst | 2 ++ setup.py | 5 ++--- sprockets/__init__.py | 4 +--- sprockets/clients/__init__.py | 1 + tests.py | 10 +++++----- tox.ini | 10 +++------- 7 files changed, 14 insertions(+), 19 deletions(-) create mode 100644 docs/api.rst diff --git a/.travis.yml b/.travis.yml index 8eb5a2a..ecccc8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python python: - 2.7 - pypy -- 3.2 - 3.3 - 3.4 install: diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..307c475 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,2 @@ +.. automodule:: sprockets.clients.cassandra + :members: diff --git a/setup.py b/setup.py index 69bc310..1bb4404 100755 --- a/setup.py +++ b/setup.py @@ -1,8 +1,7 @@ import codecs import sys -from setuptools - +import setuptools def read_requirements_file(req_name): requirements = [] @@ -25,7 +24,7 @@ tests_require = read_requirements_file('test-requirements.txt') setuptools.setup( name='sprockets.clients.cassandra', - version=sprockets.clients.cassandra.__version__, + version='0.0.0', description='Base functionality for accessing/modifying data in Cassandra', long_description=codecs.open('README.rst', encoding='utf-8').read(), url='https://github.com/sprockets/sprockets.clients.cassandra.git', diff --git a/sprockets/__init__.py b/sprockets/__init__.py index 9afb70c..de40ea7 100644 --- a/sprockets/__init__.py +++ b/sprockets/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- -version_info = (0, 0, 0) -__version__ = '.'.join(str(v) for v in version_info[:3]) +__import__('pkg_resources').declare_namespace(__name__) diff --git a/sprockets/clients/__init__.py b/sprockets/clients/__init__.py index e69de29..de40ea7 100644 --- a/sprockets/clients/__init__.py +++ b/sprockets/clients/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/tests.py b/tests.py index e95fb78..2d4f674 100644 --- a/tests.py +++ b/tests.py @@ -19,13 +19,13 @@ class TestCassandraConnectionClass(AsyncTestCase): super(TestCassandraConnectionClass, self).setUp() self.cluster = Cluster(self.find_cassandra()) 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.connection = CassandraConnection(ioloop=self.io_loop) def tearDown(self): super(TestCassandraConnectionClass, self).tearDown() - self.session.execute("DROP KEYSPACE {}".format(self.keyspace)) + self.session.execute("DROP KEYSPACE {0}".format(self.keyspace)) self.connection.shutdown() def find_cassandra(self): @@ -36,10 +36,10 @@ class TestCassandraConnectionClass(AsyncTestCase): def create_fixtures(self): self.session.execute( - "CREATE KEYSPACE IF NOT EXISTS {} WITH REPLICATION = " + "CREATE KEYSPACE IF NOT EXISTS {0} WITH REPLICATION = " "{{'class': 'SimpleStrategy', " "'replication_factor': 1}}".format(self.keyspace)) - self.session.execute("USE {}".format(self.keyspace)) + self.session.execute("USE {0}".format(self.keyspace)) self.session.execute( "CREATE TABLE IF NOT EXISTS names (name text PRIMARY KEY)") self.session.execute( @@ -51,7 +51,7 @@ class TestCassandraConnectionClass(AsyncTestCase): count = 100 for i in range(count): futures.append(self.connection.execute( - "SELECT name FROM {}.names".format(self.keyspace))) + "SELECT name FROM {0}.names".format(self.keyspace))) results = 0 for future in futures: yield future diff --git a/tox.ini b/tox.ini index 3a25764..968d11c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,12 @@ [tox] -envlist = py26,py27,py32,py33,py34 +envlist = py27,py33,py34 [testenv] commands = nosetests [] -deps = -rtest-requirements.txt +deps = -rrequirements.txt + -rtest-requirements.txt [testenv:py27] deps = mock>=1.0.1,<2.0 {[testenv]deps} - -[testenv:py26] -deps = - unittest2==0.5.1 - {[testenv:py27]deps}