Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ def pytest_addoption(parser):
"hdf5": HDF5_BACKEND,
"mdsplus": MDSPLUS_BACKEND,
}
try:
from imas.db_entry import DBEntry
from imas_core.exception import ImasCoreBackendException
DBEntry("imas:mdsplus?path=dummy","r")
except ImasCoreBackendException as iex:
if "not available" in str(iex.message):
_BACKENDS.pop("mdsplus")


try:
Expand All @@ -102,17 +95,6 @@ def backend(pytestconfig: pytest.Config, request: pytest.FixtureRequest):
return _BACKENDS[request.param]


@pytest.fixture()
def has_imas():
return _has_imas


@pytest.fixture()
def requires_imas():
if not _has_imas:
pytest.skip("No IMAS available")


def pytest_generate_tests(metafunc):
if "ids_name" in metafunc.fixturenames:
if metafunc.config.getoption("ids"):
Expand Down Expand Up @@ -214,7 +196,7 @@ def wrapper(*args, **kwargs):


@pytest.fixture
def log_lowlevel_calls(monkeypatch, requires_imas):
def log_lowlevel_calls(monkeypatch):
"""Debugging fixture to log calls to the imas lowlevel module."""
for al_function in dir(lowlevel):
if al_function.startswith("ual_") or al_function.startswith("al"):
Expand Down
4 changes: 2 additions & 2 deletions imas/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_imas_version():


@pytest.mark.cli
def test_db_analysis(tmp_path, requires_imas):
def test_db_analysis(tmp_path):
# This only tests the happy flow, error handling is not tested
db_path = tmp_path / "test_db_analysis"
with DBEntry(f"imas:hdf5?path={db_path}", "w") as entry:
Expand All @@ -42,7 +42,7 @@ def test_db_analysis(tmp_path, requires_imas):


@pytest.mark.cli
def test_db_analysis_csv(tmp_path, requires_imas):
def test_db_analysis_csv(tmp_path):
with DBEntry(f"imas:hdf5?path={tmp_path}/entry1", "w") as entry:
eq = entry.factory.equilibrium()
eq.ids_properties.homogeneous_time = 2
Expand Down
2 changes: 1 addition & 1 deletion imas/test/test_ids_ascii_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_data_exists():


@pytest.fixture
def test_data(requires_imas):
def test_data():
db_entry = imas.training.get_training_db_entry()
yield db_entry
db_entry.close()
Expand Down
2 changes: 1 addition & 1 deletion imas/test/test_ids_toplevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_pretty_print(ids):
assert pprint.pformat(ids) == "<IDSToplevel (IDS:gyrokinetics)>"


def test_serialize_nondefault_dd_version(requires_imas):
def test_serialize_nondefault_dd_version():
ids = IDSFactory("3.31.0").core_profiles()
fill_with_random_data(ids)
data = ids.serialize()
Expand Down
2 changes: 1 addition & 1 deletion imas/test/test_static_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_ids_valid_type():
assert ids_types in ({IDSType.NONE}, {IDSType.CONSTANT, IDSType.DYNAMIC})


def test_constant_ids(caplog, requires_imas):
def test_constant_ids(caplog):
ids = imas.IDSFactory().new("amns_data")
if ids.metadata.type is IDSType.NONE:
pytest.skip("IDS definition has no constant IDSs")
Expand Down
2 changes: 1 addition & 1 deletion imas/test/test_to_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@pytest.fixture
def entry(requires_imas, monkeypatch):
def entry(monkeypatch):
monkeypatch.setenv("IMAS_VERSION", "3.39.0") # Use fixed DD version
return imas.training.get_training_db_entry()

Expand Down
6 changes: 3 additions & 3 deletions imas/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_inspect():
inspect(cp.profiles_1d[1].grid.rho_tor_norm) # IDSPrimitive


def test_inspect_lazy(requires_imas):
def test_inspect_lazy():
with get_training_db_entry() as entry:
cp = entry.get("core_profiles", lazy=True)
inspect(cp)
Expand Down Expand Up @@ -141,7 +141,7 @@ def test_idsdiffgen():
assert diff[0] == ("profiles_1d/time", -1, 0)


def test_idsdiff(requires_imas):
def test_idsdiff():
# Test the diff rendering for two sample IDSs
with get_training_db_entry() as entry:
imas.util.idsdiff(entry.get("core_profiles"), entry.get("equilibrium"))
Expand Down Expand Up @@ -179,7 +179,7 @@ def test_get_toplevel():
assert get_toplevel(cp) is cp


def test_is_lazy_loaded(requires_imas):
def test_is_lazy_loaded():
with get_training_db_entry() as entry:
assert is_lazy_loaded(entry.get("core_profiles")) is False
assert is_lazy_loaded(entry.get("core_profiles", lazy=True)) is True
Expand Down
Loading