Skip to content

Commit 097e3ef

Browse files
committed
PYTHON-543 Forced cython validation
1 parent 876965a commit 097e3ef

4 files changed

Lines changed: 33 additions & 8 deletions

File tree

build.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ build:
2727
fi
2828
pip install -r test-requirements.txt
2929
pip install nose-ignore-docstring
30-
30+
FORCE_CYTHON=False
3131
if [[ $CYTHON == 'CYTHON' ]]; then
32+
FORCE_CYTHON=True
3233
pip install cython
3334
pip install numpy
3435
# Install the driver & compile C extensions
@@ -39,12 +40,12 @@ build:
3940
fi
4041
4142
echo "==========RUNNING CQLENGINE TESTS=========="
42-
CASSANDRA_VERSION=$CCM_CASSANDRA_VERSION nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=cqle_results.xml tests/integration/cqlengine/ || true
43+
CASSANDRA_VERSION=$CCM_CASSANDRA_VERSION VERIFY_CYTHON=$FORCE_CYTHON nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=cqle_results.xml tests/integration/cqlengine/ || true
4344
4445
echo "==========RUNNING INTEGRATION TESTS=========="
45-
CASSANDRA_VERSION=$CCM_CASSANDRA_VERSION nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=standard_results.xml tests/integration/standard/ || true
46+
CASSANDRA_VERSION=$CCM_CASSANDRA_VERSION VERIFY_CYTHON=$FORCE_CYTHON nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=standard_results.xml tests/integration/standard/ || true
4647
4748
echo "==========RUNNING LONG INTEGRATION TESTS=========="
48-
CASSANDRA_VERSION=$CCM_CASSANDRA_VERSION nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=long_results.xml tests/integration/long/ || true
49+
CASSANDRA_VERSION=$CCM_CASSANDRA_VERSION VERIFY_CYTHON=$FORCE_CYTHON nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=long_results.xml tests/integration/long/ || true
4950
- xunit:
5051
- "*_results.xml"

tests/integration/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ def _tuple_version(version_string):
8686

8787
USE_CASS_EXTERNAL = bool(os.getenv('USE_CASS_EXTERNAL', False))
8888

89+
# If set to to true this will force the Cython tests to run regardless of whether they are installed
90+
cython_env = os.getenv('VERIFY_CYTHON', "False")
91+
92+
93+
VERIFY_CYTHON = False
94+
95+
if(cython_env == 'True'):
96+
VERIFY_CYTHON = True
97+
8998
default_cassandra_version = '2.2.0'
9099

91100

tests/integration/standard/test_cython_protocol_handlers.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from cassandra.query import tuple_factory
1111
from cassandra.cluster import Cluster
1212
from cassandra.protocol import ProtocolHandler, LazyProtocolHandler, NumpyProtocolHandler
13-
14-
from tests.integration import use_singledc, PROTOCOL_VERSION, notprotocolv1, drop_keyspace_shutdown_cluster
13+
from cassandra.cython_deps import HAVE_CYTHON, HAVE_NUMPY
14+
from tests.integration import use_singledc, PROTOCOL_VERSION, notprotocolv1, drop_keyspace_shutdown_cluster, VERIFY_CYTHON
1515
from tests.integration.datatype_utils import update_datatypes
1616
from tests.integration.standard.utils import (
1717
create_table_with_all_types, get_all_primitive_params, get_primitive_datatypes)
@@ -123,6 +123,20 @@ def test_numpy_results_paged(self):
123123

124124
cluster.shutdown()
125125

126+
@numpytest
127+
def test_cython_numpy_are_installed_valid(self):
128+
"""
129+
Test to validate that cython and numpy are installed correctly
130+
@since 3.3.0
131+
@jira_ticket PYTHON-543
132+
@expected_result Cython and Numpy should be present
133+
134+
@test_category configuration
135+
"""
136+
if VERIFY_CYTHON:
137+
self.assertTrue(HAVE_CYTHON)
138+
self.assertTrue(HAVE_NUMPY)
139+
126140
def _verify_numpy_page(self, page):
127141
colnames = self.colnames
128142
datatypes = get_primitive_datatypes()

tests/unit/cython/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
from cassandra.cython_deps import HAVE_CYTHON, HAVE_NUMPY
16+
from tests.integration import VERIFY_CYTHON
1617

1718
try:
1819
import unittest2 as unittest
@@ -34,6 +35,6 @@ def cyimport(import_path):
3435

3536
# @cythontest
3637
# def test_something(self): ...
37-
cythontest = unittest.skipUnless(HAVE_CYTHON, 'Cython is not available')
38+
cythontest = unittest.skipUnless((HAVE_CYTHON or VERIFY_CYTHON) or VERIFY_CYTHON, 'Cython is not available')
3839
notcython = unittest.skipIf(HAVE_CYTHON, 'Cython not supported')
39-
numpytest = unittest.skipUnless(HAVE_CYTHON and HAVE_NUMPY, 'NumPy is not available')
40+
numpytest = unittest.skipUnless((HAVE_CYTHON and HAVE_NUMPY) or VERIFY_CYTHON, 'NumPy is not available')

0 commit comments

Comments
 (0)