Skip to content
Snippets Groups Projects
Commit 1312b0d5 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Don't try to connect to server on import

parent bc7aea0d
No related branches found
No related tags found
1 merge request!504Resolve "Skip ZMQ tests if zmq connection for calibration DB not available"
import socket
from functools import lru_cache
from pathlib import Path
import pytest
......@@ -32,6 +33,7 @@ def pytest_configure(config):
)
@lru_cache()
def server_reachable(server: str = "max-exfl017"):
reachable = True
......@@ -43,16 +45,11 @@ def server_reachable(server: str = "max-exfl017"):
return reachable
SERVER_REACHABLE = server_reachable()
def pytest_runtest_setup(item):
if list(item.iter_markers(name="requires_gpfs")) and (
not Path("/gpfs").is_dir() or item.config.getoption("--no-gpfs")
):
pytest.skip("gpfs not available")
if list(item.iter_markers(name="requires_caldb")) and (
not SERVER_REACHABLE or item.config.getoption("--no-caldb")
):
if list(item.iter_markers(name="requires_caldb")) and not server_reachable():
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