Skip to content
Permalink
Browse files
Respect cassandra_dir from pytest.ini
patch by Eduard Tudenhoefner; reviewed by Berenguer Blasi for
CASSANDRA-15728
  • Loading branch information
Eduard Tudenhoefner authored and blerer committed Apr 16, 2020
1 parent 88cc70b commit 158f084779159e8341c080a90d759a89006f5829
Showing 4 changed files with 15 additions and 13 deletions.
@@ -34,9 +34,9 @@ bootstrap your development environment and then use [Homebrew](https://brew.sh)

### Python Dependencies
There are multiple external Python dependencies required to run DTests.
The current Python depenendcy list is maintained in a file named
The current Python dependency list is maintained in a file named
[requirements.txt](https://github.com/apache/cassandra-dtest/blob/master/requirements.txt)
in the root of the cassandra-dtest repository.
in the root of the `cassandra-dtest` repository.

The easiest way to install these dependencies is with pip and virtualenv.

@@ -73,7 +73,7 @@ Use ccm ability to download/compile released sources from archives.apache.org:
pytest --cassandra-version=1.0.0

A convenient option if tests are regularly run against the same existing
directory is to set a `cassandra_dir` in `~/path/to/cassandra-dtest/pytest.ini`:
directory is to set `cassandra_dir` in `~/path/to/cassandra-dtest/pytest.ini`:

[pytest]
cassandra_dir=~/path/to/cassandra
@@ -98,11 +98,6 @@ To run the upgrade tests, you have must both JDK7 and JDK8 installed. Paths
to these installations should be defined in the environment variables
JAVA7_HOME and JAVA8_HOME, respectively.

Installation Instructions
-------------------------

See more detailed instructions in the included [INSTALL file](https://github.com/apache/cassandra-dtest/blob/master/INSTALL.md).

Writing Tests
-------------

@@ -62,6 +62,11 @@ def pytest_addoption(parser):
"(e.g. the path to the root of a cloned C* git directory. Before executing dtests using "
"this directory you must build C* with 'ant clean jar'). If you're doing C* development and "
"want to run the tests this is almost always going to be the correct option.")
parser.addini("cassandra_dir", default=None,
help="The directory containing the built C* artifacts to run the tests against. "
"(e.g. the path to the root of a cloned C* git directory. Before executing dtests using "
"this directory you must build C* with 'ant clean jar'). If you're doing C* development and "
"want to run the tests this is almost always going to be the correct option.")
parser.addoption("--cassandra-version", action="store", default=None,
help="A specific C* version to run the dtests against. The dtest framework will "
"pull the required artifacts for this version.")
@@ -432,12 +437,13 @@ def pytest_collection_modifyitems(items, config):
of the test items within the list
"""
collect_only = config.getoption("--collect-only")
cassandra_dir = config.getoption("--cassandra-dir")
cassandra_dir = config.getoption("--cassandra-dir") or config.getini("cassandra_dir")
cassandra_version = config.getoption("--cassandra-version")
if not collect_only and cassandra_dir is None:
if cassandra_version is None:
raise Exception("Required dtest arguments were missing! You must provide either --cassandra-dir "
"or --cassandra-version. Refer to the documentation or invoke the help with --help.")
"or --cassandra-version. You can also set 'cassandra_dir' in pytest.ini. "
"Refer to the documentation or invoke the help with --help.")

# Either cassandra_version or cassandra_dir is defined, so figure out the version
CASSANDRA_VERSION = cassandra_version or get_version_from_build(cassandra_dir)
@@ -29,8 +29,9 @@ def setup(self, request):
self.data_dir_count = request.config.getoption("--data-dir-count-per-instance")
self.force_execution_of_resource_intensive_tests = request.config.getoption("--force-resource-intensive-tests")
self.skip_resource_intensive_tests = request.config.getoption("--skip-resource-intensive-tests")
if request.config.getoption("--cassandra-dir") is not None:
self.cassandra_dir = os.path.expanduser(request.config.getoption("--cassandra-dir"))
cassandra_dir = request.config.getoption("--cassandra-dir") or request.config.getini("cassandra_dir")
if cassandra_dir is not None:
self.cassandra_dir = os.path.expanduser(cassandra_dir)
self.cassandra_version = request.config.getoption("--cassandra-version")

self.cassandra_version_from_build = self.get_version_from_build()
@@ -62,7 +62,7 @@ def set_version_family():
# strategy as the actual checkout code in Tester.setUp; if it does not, that is
# a bug.
cassandra_version_slug = CONFIG.getoption("--cassandra-version")
cassandra_dir = CONFIG.getoption("--cassandra-dir")
cassandra_dir = CONFIG.getoption("--cassandra-dir") or CONFIG.getini("cassandra_dir")
# Prefer CASSANDRA_VERSION if it's set in the environment. If not, use CASSANDRA_DIR
if cassandra_version_slug:
# fetch but don't build the specified C* version

0 comments on commit 158f084

Please sign in to comment.