From 0607669cbb66cff947541420d310d18144285015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Berland?= Date: Mon, 28 Oct 2024 12:52:24 +0100 Subject: [PATCH] Avoid misuse of pytest.mark.xfail in pyscal test Test this SystemExit explicitly instead as it is not going to change. --- tests/forward_models/pyscal/test_pyscal.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/forward_models/pyscal/test_pyscal.py b/tests/forward_models/pyscal/test_pyscal.py index d82341b7..6109ab18 100644 --- a/tests/forward_models/pyscal/test_pyscal.py +++ b/tests/forward_models/pyscal/test_pyscal.py @@ -26,12 +26,6 @@ [ (EXAMPLE_STATIC_DFRAME, ["__NONE__", "__NONE__", "__NONE__", "sgof", 1]), (EXAMPLE_STATIC_DFRAME, ["__NONE__", "__NONE__", "__NONE__", "slgof", 1]), - pytest.param( - EXAMPLE_STATIC_DFRAME, - ["__NONE__", "__NONE__", "__NONE__", "slgof", 2], - marks=pytest.mark.xfail(raises=SystemExit), - id="SLGOF_family_2_not_meaningful", - ), (EXAMPLE_STATIC_DFRAME, ["__NONE__", "__NONE__", "__NONE__", "sgof", 2]), (EXAMPLE_WATEROIL, ["__NONE__", "__NONE__", "__NONE__", "sgof", 1]), (EXAMPLE_SCAL, ["__NONE__", "INTERPOLATE_WO", "INTERPOLATE_GO", "sgof", 1]), @@ -66,6 +60,21 @@ def test_fm_pyscal(dframe, runargs, tmpdir): assert len(Path("relperm.inc").read_text(encoding="utf-8")) > 20 +def test_fm_pyscal_errors_on_slgof_family_2(tmpdir): + tmpdir.chdir() + EXAMPLE_STATIC_DFRAME.to_csv("relperm-input.csv", index=False) + with pytest.raises(SystemExit): + run( + "relperm-input.csv", + "relperm.inc", + "__NONE__", + "__NONE__", + "__NONE__", + "slgof", + 2, + ) + + def test_fm_pysal_static_xlsx(tmpdir): """Test fm_pyscal on a static xlsx file""" tmpdir.chdir()