Integrate cqlengine tests into tox.ini
This commit is contained in:
@@ -35,7 +35,7 @@ try:
|
|||||||
from ccmlib.cluster_factory import ClusterFactory as CCMClusterFactory
|
from ccmlib.cluster_factory import ClusterFactory as CCMClusterFactory
|
||||||
from ccmlib import common
|
from ccmlib import common
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
raise unittest.SkipTest('ccm is a dependency for integration tests:', e)
|
CCMClusterFactory = None
|
||||||
|
|
||||||
CLUSTER_NAME = 'test_cluster'
|
CLUSTER_NAME = 'test_cluster'
|
||||||
SINGLE_NODE_CLUSTER_NAME = 'single_node'
|
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('.')])
|
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'
|
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()
|
path = common.get_default_path()
|
||||||
name = common.current_cluster_name(path)
|
name = common.current_cluster_name(path)
|
||||||
CCM_CLUSTER = CCMClusterFactory.load(common.get_default_path(), name)
|
CCM_CLUSTER = CCMClusterFactory.load(common.get_default_path(), name)
|
||||||
@@ -136,7 +137,7 @@ def use_single_node(start=True):
|
|||||||
|
|
||||||
|
|
||||||
def remove_cluster():
|
def remove_cluster():
|
||||||
if USE_CCM_CASS_EXTERNAL:
|
if USE_CASS_EXTERNAL:
|
||||||
return
|
return
|
||||||
|
|
||||||
global CCM_CLUSTER
|
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):
|
def use_cluster(cluster_name, nodes, ipformat=None, start=True):
|
||||||
global CCM_CLUSTER
|
global CCM_CLUSTER
|
||||||
if USE_CCM_CASS_EXTERNAL:
|
if USE_CASS_EXTERNAL:
|
||||||
log.debug("Using external cluster %s", CCM_CLUSTER.name)
|
if CCM_CLUSTER:
|
||||||
|
log.debug("Using external ccm cluster %s", CCM_CLUSTER.name)
|
||||||
|
else:
|
||||||
|
log.debug("Using unnamed external cluster")
|
||||||
return
|
return
|
||||||
|
|
||||||
if is_current_cluster(cluster_name, nodes):
|
if is_current_cluster(cluster_name, nodes):
|
||||||
@@ -194,7 +198,7 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True):
|
|||||||
|
|
||||||
|
|
||||||
def teardown_package():
|
def teardown_package():
|
||||||
if USE_CCM_CASS_EXTERNAL:
|
if USE_CASS_EXTERNAL:
|
||||||
return
|
return
|
||||||
# when multiple modules are run explicitly, this runs between them
|
# when multiple modules are run explicitly, this runs between them
|
||||||
# need to make sure CCM_CLUSTER is properly cleared for that case
|
# need to make sure CCM_CLUSTER is properly cleared for that case
|
||||||
|
|||||||
@@ -11,4 +11,7 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
try:
|
||||||
|
from ccmlib import common
|
||||||
|
except ImportError as e:
|
||||||
|
raise unittest.SkipTest('ccm is a dependency for integration tests:', e)
|
||||||
|
|||||||
@@ -11,4 +11,7 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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
47
tox.ini
@@ -1,55 +1,30 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py26,py27,pypy,py33,py34
|
envlist = py26,py27,pypy,py33,py34
|
||||||
|
|
||||||
[testenv]
|
[base]
|
||||||
deps = nose
|
deps = nose
|
||||||
mock
|
mock
|
||||||
ccm
|
|
||||||
unittest2
|
unittest2
|
||||||
pip
|
|
||||||
PyYAML
|
PyYAML
|
||||||
six
|
six
|
||||||
blist
|
|
||||||
commands = {envpython} setup.py build_ext --inplace
|
|
||||||
nosetests --verbosity=2 tests/unit/
|
|
||||||
|
|
||||||
[testenv:py33]
|
[testenv]
|
||||||
deps = nose
|
deps = {[base]deps}
|
||||||
mock
|
|
||||||
pip
|
|
||||||
PyYAML
|
|
||||||
six
|
|
||||||
scales
|
|
||||||
blist
|
blist
|
||||||
|
sure
|
||||||
|
setenv = USE_CASS_EXTERNAL=1
|
||||||
commands = {envpython} setup.py build_ext --inplace
|
commands = {envpython} setup.py build_ext --inplace
|
||||||
nosetests --verbosity=2 tests/unit/
|
nosetests --verbosity=2 tests/unit/
|
||||||
|
nosetests --verbosity=2 tests/integration/cqlengine
|
||||||
|
|
||||||
[testenv:py34]
|
[testenv:py26]
|
||||||
deps = nose
|
|
||||||
mock
|
|
||||||
pip
|
|
||||||
PyYAML
|
|
||||||
six
|
|
||||||
scales
|
|
||||||
blist
|
|
||||||
commands = {envpython} setup.py build_ext --inplace
|
commands = {envpython} setup.py build_ext --inplace
|
||||||
nosetests --verbosity=2 tests/unit/
|
nosetests --verbosity=2 tests/unit/
|
||||||
|
# no cqlengine support for 2.6 right now
|
||||||
|
|
||||||
[testenv:pypy]
|
[testenv:pypy]
|
||||||
deps = nose
|
deps = {[base]deps}
|
||||||
mock
|
|
||||||
ccm
|
|
||||||
unittest2
|
|
||||||
pip
|
|
||||||
PyYAML
|
|
||||||
scales
|
|
||||||
six
|
|
||||||
commands = {envpython} setup.py build_ext --inplace
|
commands = {envpython} setup.py build_ext --inplace
|
||||||
nosetests --verbosity=2 tests/unit/
|
nosetests --verbosity=2 tests/unit/
|
||||||
|
# cqlengine/test_timestamp.py uses sure, which fails in pypy presently
|
||||||
# TODO: integrate cqlengine tests
|
# could remove sure usage
|
||||||
#envlist=py27,py34
|
|
||||||
#
|
|
||||||
#[testenv]
|
|
||||||
#deps= -rrequirements.txt
|
|
||||||
#commands=bin/test.py --no-skip
|
|
||||||
|
|||||||
Reference in New Issue
Block a user