From 6050b4c7ab06e8b5aa721cbb275d6613f6fc721c Mon Sep 17 00:00:00 2001 From: mferrera Date: Wed, 6 Nov 2024 12:23:32 +0100 Subject: [PATCH] FIX: Review feedback --- src/fmu/dataio/providers/_fmu.py | 1 + tests/data/snakeoil/export-a-surface | 6 +++--- tests/test_integration/conftest.py | 2 +- tests/test_integration/ert_config_utils.py | 14 +++++++------- tests/test_units/test_fmuprovider_class.py | 7 ++++--- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/fmu/dataio/providers/_fmu.py b/src/fmu/dataio/providers/_fmu.py index 540f92cb6..f7abc233e 100644 --- a/src/fmu/dataio/providers/_fmu.py +++ b/src/fmu/dataio/providers/_fmu.py @@ -206,6 +206,7 @@ def _get_runpath_from_env() -> Path | None: @staticmethod def _get_ert_meta() -> fields.Ert: + """Constructs the `Ert` Pydantic object for the `ert` metadata field.""" try: sim_mode = ErtSimulationMode(FmuEnv.SIMULATION_MODE.value) except ValueError: diff --git a/tests/data/snakeoil/export-a-surface b/tests/data/snakeoil/export-a-surface index a9d340ecf..272dcce4e 100755 --- a/tests/data/snakeoil/export-a-surface +++ b/tests/data/snakeoil/export-a-surface @@ -10,10 +10,10 @@ from fmu.config import utilities as ut def main() -> None: - snakeoil_path = Path(sys.argv[1]) - CFG = ut.yaml_load(snakeoil_path / "fmuconfig/output/global_variables.yml") + project_path = Path(sys.argv[1]) + CFG = ut.yaml_load(project_path / "fmuconfig/output/global_variables.yml") surf = xtgeo.surface_from_file( - snakeoil_path / "ert/output/maps/props/poro_average.gri" + project_path / "ert/output/maps/props/poro_average.gri" ) dataio.ExportData( config=CFG, diff --git a/tests/test_integration/conftest.py b/tests/test_integration/conftest.py index 0a70a7c12..a63dd8642 100644 --- a/tests/test_integration/conftest.py +++ b/tests/test_integration/conftest.py @@ -86,7 +86,7 @@ def fmu_snakeoil_project( "STDERR EXPORT_A_SURFACE.stderr\n" "STDOUT EXPORT_A_SURFACE.stdout\n" "EXECUTABLE ../scripts/export-a-surface\n" - "ARGLIST \n", + "ARGLIST \n", encoding="utf-8", ) diff --git a/tests/test_integration/ert_config_utils.py b/tests/test_integration/ert_config_utils.py index 8658bed92..6b9dd6f6b 100644 --- a/tests/test_integration/ert_config_utils.py +++ b/tests/test_integration/ert_config_utils.py @@ -3,8 +3,8 @@ from pathlib import Path -def add_create_case_workflow(filepath: Path | str) -> None: - with open(filepath, "a", encoding="utf-8") as f: +def add_create_case_workflow(ert_config_path: Path | str) -> None: + with open(ert_config_path, "a", encoding="utf-8") as f: f.writelines( [ "LOAD_WORKFLOW ../bin/workflows/xhook_create_case_metadata\n" @@ -13,8 +13,8 @@ def add_create_case_workflow(filepath: Path | str) -> None: ) -def add_copy_preprocessed_workflow(filepath: Path | str) -> None: - with open(filepath, "a", encoding="utf-8") as f: +def add_copy_preprocessed_workflow(ert_config_path: Path | str) -> None: + with open(ert_config_path, "a", encoding="utf-8") as f: f.writelines( [ "LOAD_WORKFLOW ../bin/workflows/xhook_copy_preprocessed_data\n" @@ -24,12 +24,12 @@ def add_copy_preprocessed_workflow(filepath: Path | str) -> None: def add_export_a_surface_forward_model( - snakeoil_path: Path, filepath: Path | str + project_path: Path, ert_config_path: Path | str ) -> None: - with open(filepath, "a", encoding="utf-8") as f: + with open(ert_config_path, "a", encoding="utf-8") as f: f.writelines( [ "INSTALL_JOB EXPORT_A_SURFACE ../bin/jobs/EXPORT_A_SURFACE\n" - f"FORWARD_MODEL EXPORT_A_SURFACE(={snakeoil_path})\n" + f"FORWARD_MODEL EXPORT_A_SURFACE(={project_path})\n" ] ) diff --git a/tests/test_units/test_fmuprovider_class.py b/tests/test_units/test_fmuprovider_class.py index dd7cc4b85..27a2d81cc 100644 --- a/tests/test_units/test_fmuprovider_class.py +++ b/tests/test_units/test_fmuprovider_class.py @@ -410,9 +410,10 @@ def test_fmuprovider_workflow_reference(fmurun_w_casemetadata, globalconfig2): def test_ert_simulation_modes_one_to_one() -> None: - """Ensure dataio known modes match those defined by Ert. These are currently defined - in `ert.mode_definitions`. `MODULE_MODE` is skipped due to seemingly being relevant - to Ert internally -- the modes are duplicated there.""" + """Ensure dataio known modes match those defined by Ert. + + These are currently defined in `ert.mode_definitions`. `MODULE_MODE` is skipped due + to seemingly being relevant to Ert internally -- the modes are duplicated there.""" ert_mode_definitions = importlib.import_module("ert.mode_definitions") ert_modes = { getattr(ert_mode_definitions, name)