3232 UniformParameter ,
3333)
3434from fmu .settings import get_fmu_directory
35- from pytest import CaptureFixture , MonkeyPatch
35+ from pytest import MonkeyPatch
3636
3737from fmu .dataio ._interfaces import SumoUploaderInterface
3838from fmu .dataio ._workflows .case ._observations import get_ert_observations_table
@@ -228,12 +228,10 @@ def test_create_case_metadata_warns_without_overwriting(
228228
229229
230230def test_create_case_metadata_caseroot_not_defined (
231- fmu_snakeoil_project : Path ,
232- monkeypatch : MonkeyPatch ,
233- capsys : CaptureFixture [str ],
231+ fmu_snakeoil_project : Path , monkeypatch : MonkeyPatch
234232) -> None :
235- """Test that a proper error message is given if the case path is
236- input as an undefined ERT variable"""
233+ """Test that a ERT is stopped and that a proper error message is given
234+ if the case path is input as an undefined ERT variable"""
237235 pathlib .Path (
238236 fmu_snakeoil_project / "ert/bin/workflows/xhook_create_case_metadata"
239237 ).write_text (
@@ -247,21 +245,21 @@ def test_create_case_metadata_caseroot_not_defined(
247245
248246 add_create_case_workflow (ert_config_path )
249247
250- with patch ("sys.argv" , ["ert" , "test_run" , "snakeoil.ert" , "--disable-monitoring" ]):
248+ with (
249+ patch ("sys.argv" , ["ert" , "test_run" , "snakeoil.ert" , "--disable-monitoring" ]),
250+ pytest .raises (SystemExit , match = "Ert variable for case path is not defined" ),
251+ ):
251252 ert .__main__ .main ()
252253
253- _stdout , stderr = capsys .readouterr ()
254- assert "ValueError: Ert variable for case path is not defined" in stderr
255-
256254
257255def test_create_case_metadata_deprecated_arguments_warn (
258256 fmu_snakeoil_project : Path , monkeypatch : MonkeyPatch
259257) -> None :
260- """Now deprecated arguments issue warnings."""
258+ """Test that deprecated arguments issue warnings."""
261259 pathlib .Path (
262260 fmu_snakeoil_project / "ert/bin/workflows/xhook_create_case_metadata"
263261 ).write_text (
264- "WF_CREATE_CASE_METADATA <CASEPATH_NOT_DEFINED > <CONFIG_PATH> <CASE_DIR>" ,
262+ "WF_CREATE_CASE_METADATA <SCRATCH>/<USER>/<CASE_DIR > <CONFIG_PATH> <CASE_DIR>" ,
265263 encoding = "utf-8" ,
266264 )
267265
@@ -322,7 +320,6 @@ def test_create_case_metadata_sumo_env_dev_input_fails(
322320 fmu_snakeoil_project : Path ,
323321 monkeypatch : MonkeyPatch ,
324322 mock_sumo_uploader : dict [str , MagicMock | AsyncMock ],
325- capsys : CaptureFixture [str ],
326323) -> None :
327324 """Test that if the sumo_env argument is input as dev it raises an error"""
328325 with open (
@@ -341,13 +338,10 @@ def test_create_case_metadata_sumo_env_dev_input_fails(
341338 with (
342339 patch ("sys.argv" , ["ert" , "test_run" , "snakeoil.ert" , "--disable-monitoring" ]),
343340 pytest .warns (FutureWarning , match = "'--sumo_env' is deprecated" ),
341+ pytest .raises (SystemExit , match = " Setting sumo environment through argument" ),
344342 ):
345343 ert .__main__ .main ()
346344
347- _stdout , stderr = capsys .readouterr ()
348- assert "ValueError: Setting sumo environment through argument" in stderr
349- assert "SUMO_ENV" in stderr
350-
351345
352346@pytest .mark .skipif (
353347 not importlib .util .find_spec ("fmu.sumo.uploader" ),
0 commit comments