|
34 | 34 | from itertools import groupby
|
35 | 35 | import six
|
36 | 36 | import shutil
|
| 37 | +import pytest |
37 | 38 |
|
38 | 39 |
|
39 | 40 | from cassandra import OperationTimedOut, ReadTimeout, ReadFailure, WriteTimeout, WriteFailure, AlreadyExists,\
|
@@ -366,8 +367,14 @@ def _id_and_mark(f):
|
366 | 367 | lessthandse51 = unittest.skipUnless(DSE_VERSION and DSE_VERSION < Version('5.1'), "DSE version less than 5.1 required")
|
367 | 368 | lessthandse60 = unittest.skipUnless(DSE_VERSION and DSE_VERSION < Version('6.0'), "DSE version less than 6.0 required")
|
368 | 369 |
|
369 |
| -requires_collection_indexes = unittest.skipUnless(SCYLLA_VERSION is None or Version(SCYLLA_VERSION.split(':')[1]) >= Version('5.2'), 'Test requires Scylla >= 5.2 or Cassandra') |
370 |
| -requires_custom_indexes = unittest.skipUnless(SCYLLA_VERSION is None, 'Currently, Scylla does not support SASI or any other CUSTOM INDEX class.') |
| 370 | +# pytest.mark.xfail instead of unittest.expectedFailure because |
| 371 | +# 1. unittest doesn't skip setUpClass when used on class and we need it sometimes |
| 372 | +# 2. unittest doesn't have conditional xfail, and I prefer to use pytest than custom decorator |
| 373 | +# 3. unittest doesn't have a reason argument, so you don't see the reason in pytest report |
| 374 | +requires_collection_indexes = pytest.mark.xfail(SCYLLA_VERSION is not None and Version(SCYLLA_VERSION.split(':')[1]) < Version('5.2'), |
| 375 | + reason='Scylla supports collection indexes from 5.2 onwards') |
| 376 | +requires_custom_indexes = pytest.mark.xfail(SCYLLA_VERSION is not None, |
| 377 | + reason='Scylla does not support SASI or any other CUSTOM INDEX class') |
371 | 378 |
|
372 | 379 | pypy = unittest.skipUnless(platform.python_implementation() == "PyPy", "Test is skipped unless it's on PyPy")
|
373 | 380 | notpy3 = unittest.skipIf(sys.version_info >= (3, 0), "Test not applicable for Python 3.x runtime")
|
|
0 commit comments