From 25fa864e319a836e2783e7023f17d604ee12d748 Mon Sep 17 00:00:00 2001 From: Alif Be <11570927+alifbe@users.noreply.github.com> Date: Fri, 7 Jun 2024 06:54:22 +0000 Subject: [PATCH] prtvol2csv test against latest flow/eclipse simulator output --- tests/test_prtvol2csv.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/test_prtvol2csv.py b/tests/test_prtvol2csv.py index 91895f5bc..5742f55a9 100644 --- a/tests/test_prtvol2csv.py +++ b/tests/test_prtvol2csv.py @@ -1,6 +1,7 @@ """Test prtvol2csv, both as library and as command line""" import os +import shutil import subprocess import sys from pathlib import Path @@ -13,8 +14,45 @@ from subscript.prtvol2csv import prtvol2csv +from .utils import run_simulator + TESTDATADIR = Path(__file__).absolute().parent / "data/reek/eclipse/model" +DROGON_TEST_DATA_DIR = Path(__file__).absolute().parent / "data/drogon/eclipse" + + +def test_valid_flow_output(simulator, tmp_path, mocker): + """Test that latest simulation output from flow can be processed""" + + shutil.copytree(DROGON_TEST_DATA_DIR, tmp_path / "eclipse") + os.chdir(tmp_path / "eclipse/model") + + Path(tmp_path / "eclipse/include/schedule/drogon_hist.sch").write_text( + """ + TSTEP + 0.0001 / + / + + END + """, # noqa + encoding="utf8", + ) + run_simulator(simulator, Path(tmp_path / "eclipse/model/DROGON-0.DATA")) + + with pytest.warns(FutureWarning, match="Output directories"): + mocker.patch( + "sys.argv", + [ + "prtvol2csv", + "--debug", + str(Path(tmp_path / "eclipse/model/DROGON-0.PRT")), + ], + ) + prtvol2csv.main() + dframe = pd.read_csv("share/results/volumes/simulator_volume_fipnum.csv") + + assert dframe.shape == (21, 13) + def test_currently_in_place_from_prt(tmp_path): """Test parsing of PRT to find currently in place"""