In issue #7722, it was suggested that we should port Cassandra's CQL unit tests into our own repository, by translating the Java tests into Python using the new cql-pytest framework. Cassandra's CQL unit test framework is orders of magnitude faster than dtest, and in-tree, so Cassandra have been moving many CQL correctness tests there, and we can also benefit from their test cases. In this patch, we take the first step in a long journey: 1. I created a subdirectory, test/cql-pytest/cassandra_tests, where all the translated Cassandra tests will reside. The structure of this directory will mirror that of the test/unit/org/apache/cassandra/cql3 directory in the Cassandra repository. pytest conveniently looks for test files recursively, so when all the cql-pytest are run, the cassandra_tests files will be run as well. As usual, one can also run only a subset of all the tests, e.g., "test/cql-pytest/run -vs cassandra_tests" runs only the tests in the cassandra_tests subdirectory (and its subdirectories). 2. I translated into Python two of the smallest test files - validation/entities/{TimeuuidTest,DataTypeTest}.java - containing just three test functions. The plan is to translate entire Java test files one by one, and to mirror their original location in our own repository, so it will be easier to remember what we already translated and what remains to be done. 3. I created a small library, porting.py, of functions which resemble the common functions of the Java tests (CQLTester.java). These functions aim to make porting the tests easier. Despite the resemblence, the ported code is not 100% identical (of course) and some effort is still required in this porting. As we continue this porting effort, we'll probably need more of these functions, can can also continue to improve them to reduce the porting effort. Refs #7722. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20201201192142.2285582-1-nyh@scylladb.com>
6 lines
237 B
Python
6 lines
237 B
Python
# This file is automatically imported before importing porting.py, and
|
|
# causes pytest to rewrite (i.e., improve) assert calls in utility
|
|
# functions in porting.py.
|
|
import pytest
|
|
pytest.register_assert_rewrite("cassandra_tests.porting")
|