diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -25,7 +25,9 @@ #### Non Debian-like host -The tests expects `/usr/sbin/cassandra` to exist. +The tests expects the binary `cassandra` to exist somewhere. You must specify a +non-conventional full path in the environment variable `BIN_CASSANDRA`. If not +provided, this defaults to look it up at `/usr/sbin/cassandra`. Optionally, you can avoid running the cassandra tests. diff --git a/swh/storage/tests/test_cassandra.py b/swh/storage/tests/test_cassandra.py --- a/swh/storage/tests/test_cassandra.py +++ b/swh/storage/tests/test_cassandra.py @@ -100,9 +100,11 @@ stdout = stderr = None else: stdout = stderr = subprocess.DEVNULL + + bin_cassandra = os.environ.get("BIN_CASSANDRA", "/usr/sbin/cassandra") proc = subprocess.Popen( [ - "/usr/sbin/cassandra", + bin_cassandra, "-Dcassandra.config=file://%s/cassandra.yaml" % cassandra_conf, "-Dcassandra.logdir=%s" % cassandra_log, "-Dcassandra.jmx.local.port=%d" % jmx_port, @@ -124,8 +126,10 @@ yield (["127.0.0.1"], native_transport_port) if not running or os.environ.get("LOG_CASSANDRA"): - with open(str(cassandra_log.join("debug.log"))) as fd: - print(fd.read()) + debug_log_path = str(cassandra_log.join("debug.log")) + if os.path.exists(debug_log_path): + with open(debug_log_path) as fd: + print(fd.read()) if not running: raise Exception("cassandra process stopped unexpectedly.") diff --git a/tox.ini b/tox.ini --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ pytest-cov dev: ipdb passenv = + BIN_CASSANDRA LOG_CASSANDRA commands = pytest \