Integrate cqlengine tests into tox.ini

This commit is contained in:
Adam Holmberg
2015-02-09 17:20:35 -06:00
parent cf29b39729
commit b3243f78b5
4 changed files with 30 additions and 45 deletions

View File

@@ -35,7 +35,7 @@ try:
from ccmlib.cluster_factory import ClusterFactory as CCMClusterFactory
from ccmlib import common
except ImportError as e:
raise unittest.SkipTest('ccm is a dependency for integration tests:', e)
CCMClusterFactory = None
CLUSTER_NAME = 'test_cluster'
SINGLE_NODE_CLUSTER_NAME = 'single_node'
@@ -81,11 +81,12 @@ def _tuple_version(version_string):
return tuple([int(p) for p in version_string.split('.')])
USE_CCM_CASS_EXTERNAL = bool(os.getenv('USE_CCM_CASS_EXTERNAL', False))
USE_CASS_EXTERNAL = bool(os.getenv('USE_CASS_EXTERNAL', False))
default_cassandra_version = '2.1.2'
if USE_CCM_CASS_EXTERNAL:
if USE_CASS_EXTERNAL and CCMClusterFactory:
# see if the external instance is running in ccm
path = common.get_default_path()
name = common.current_cluster_name(path)
CCM_CLUSTER = CCMClusterFactory.load(common.get_default_path(), name)
@@ -136,7 +137,7 @@ def use_single_node(start=True):
def remove_cluster():
if USE_CCM_CASS_EXTERNAL:
if USE_CASS_EXTERNAL:
return
global CCM_CLUSTER
@@ -157,8 +158,11 @@ def is_current_cluster(cluster_name, node_counts):
def use_cluster(cluster_name, nodes, ipformat=None, start=True):
global CCM_CLUSTER
if USE_CCM_CASS_EXTERNAL:
log.debug("Using external cluster %s", CCM_CLUSTER.name)
if USE_CASS_EXTERNAL:
if CCM_CLUSTER:
log.debug("Using external ccm cluster %s", CCM_CLUSTER.name)
else:
log.debug("Using unnamed external cluster")
return
if is_current_cluster(cluster_name, nodes):
@@ -194,7 +198,7 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True):
def teardown_package():
if USE_CCM_CASS_EXTERNAL:
if USE_CASS_EXTERNAL:
return
# when multiple modules are run explicitly, this runs between them
# need to make sure CCM_CLUSTER is properly cleared for that case

View File

@@ -11,4 +11,7 @@
# 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.
try:
from ccmlib import common
except ImportError as e:
raise unittest.SkipTest('ccm is a dependency for integration tests:', e)

View File

@@ -11,4 +11,7 @@
# 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.
try:
from ccmlib import common
except ImportError as e:
raise unittest.SkipTest('ccm is a dependency for integration tests:', e)

47
tox.ini
View File

@@ -1,55 +1,30 @@
[tox]
envlist = py26,py27,pypy,py33,py34
[testenv]
[base]
deps = nose
mock
ccm
unittest2
pip
PyYAML
six
blist
commands = {envpython} setup.py build_ext --inplace
nosetests --verbosity=2 tests/unit/
[testenv:py33]
deps = nose
mock
pip
PyYAML
six
scales
[testenv]
deps = {[base]deps}
blist
sure
setenv = USE_CASS_EXTERNAL=1
commands = {envpython} setup.py build_ext --inplace
nosetests --verbosity=2 tests/unit/
nosetests --verbosity=2 tests/integration/cqlengine
[testenv:py34]
deps = nose
mock
pip
PyYAML
six
scales
blist
[testenv:py26]
commands = {envpython} setup.py build_ext --inplace
nosetests --verbosity=2 tests/unit/
# no cqlengine support for 2.6 right now
[testenv:pypy]
deps = nose
mock
ccm
unittest2
pip
PyYAML
scales
six
deps = {[base]deps}
commands = {envpython} setup.py build_ext --inplace
nosetests --verbosity=2 tests/unit/
# TODO: integrate cqlengine tests
#envlist=py27,py34
#
#[testenv]
#deps= -rrequirements.txt
#commands=bin/test.py --no-skip
# cqlengine/test_timestamp.py uses sure, which fails in pypy presently
# could remove sure usage