This is an automated email from the ASF dual-hosted git repository.

blerer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/master by this push:
     new 158f084  Respect cassandra_dir from pytest.ini
158f084 is described below

commit 158f084779159e8341c080a90d759a89006f5829
Author: Eduard Tudenhoefner <[email protected]>
AuthorDate: Wed Apr 15 09:37:35 2020 +0200

    Respect cassandra_dir from pytest.ini
    
    patch by Eduard Tudenhoefner; reviewed by Berenguer Blasi for
    CASSANDRA-15728
---
 README.md                         | 11 +++--------
 conftest.py                       | 10 ++++++++--
 dtest_config.py                   |  5 +++--
 upgrade_tests/upgrade_manifest.py |  2 +-
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 7519925..a6be874 100644
--- a/README.md
+++ b/README.md
@@ -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
 -------------
 
diff --git a/conftest.py b/conftest.py
index b46f8b5..0229ae0 100644
--- a/conftest.py
+++ b/conftest.py
@@ -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)
diff --git a/dtest_config.py b/dtest_config.py
index 490cd40..358224e 100644
--- a/dtest_config.py
+++ b/dtest_config.py
@@ -29,8 +29,9 @@ class DTestConfig:
         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()
diff --git a/upgrade_tests/upgrade_manifest.py 
b/upgrade_tests/upgrade_manifest.py
index 1cd9b2c..bca6c97 100644
--- a/upgrade_tests/upgrade_manifest.py
+++ b/upgrade_tests/upgrade_manifest.py
@@ -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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to