Skip to content
Snippets Groups Projects
Commit fee8de1d authored by Robert Rosca's avatar Robert Rosca Committed by Thomas Kluyver
Browse files

Add rough check that caldb is available

Doesn't really check that though, just sees if max-exfl017 is reachable
parent 2cd82d53
No related branches found
No related tags found
1 merge request!504Resolve "Skip ZMQ tests if zmq connection for calibration DB not available"
import subprocess
from pathlib import Path
import pytest
import subprocess
def pytest_addoption(parser):
......@@ -11,10 +13,23 @@ def pytest_addoption(parser):
help="Skips tests marked as requiring GPFS access",
)
parser.addoption(
"--no-caldb",
action="store_true",
default=False,
help="Skips tests marked as requiring calDBs",
)
def pytest_configure(config):
config.addinivalue_line(
"markers", "requires_gpfs(): marks skips for tests that require GPFS access"
"markers",
"requires_gpfs(): marks skips for tests that require GPFS access",
)
config.addinivalue_line(
"markers",
"requires_caldb(): marks skips for tests that require calDB access",
)
......@@ -23,3 +38,14 @@ def pytest_runtest_setup(item):
not Path("/gpfs").is_dir() or item.config.getoption("--no-gpfs")
):
pytest.skip("gpfs not available")
server_available = True
try:
subprocess.check_output("ping max-exfl017 -c 1", shell=True)
except subprocess.CalledProcessError:
server_available = False
if (
list(item.iter_markers(name="requires_caldb")) and not server_available
) or item.config.getoption("--no-caldb"):
pytest.skip("caldb not available")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment