Skip to content

Commit

Permalink
tmp work
Browse files Browse the repository at this point in the history
  • Loading branch information
berland committed Dec 9, 2024
1 parent 9d165b0 commit 1fa5ed6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/ert/unit_tests/resources/test_run_flow_simulator.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import os
import shutil
from pathlib import Path
from subprocess import CalledProcessError
from unittest import mock

import pytest

from tests.ert.utils import SOURCE_DIR

from ._import_from_location import import_from_location

# import ecl_config.py and ecl_run from ert/forward-models package-data path
# which. These are kept out of the ert package to avoid the overhead of
# import code from ert/forward_models package-data path.
# These are kept out of the ert package to avoid the overhead of
# importing ert. This is necessary as these may be invoked as a subprocess on
# each realization.

Expand All @@ -22,6 +24,7 @@


@pytest.mark.integration_test
@pytest.mark.skipif(not shutil.which("flowrun"), reason="flowrun not available")
def test_flow_can_produce_output(source_root):
shutil.copy(source_root / "test-data/ert/eclipse/SPE1.DATA", "SPE1.DATA")
run_reservoirsimulator.RunReservoirSimulator(
Expand All @@ -30,7 +33,15 @@ def test_flow_can_produce_output(source_root):
assert Path("SPE1.UNSMRY").exists()


@mock.patch.dict(os.environ, {"FLOWRUN_PATH": ""}, clear=True)
def test_flowrun_can_be_bypassed(tmp_path, monkeypatch):
monkeypatch.setenv("FLOWRUN_PATH", str(tmp_path))
print(shutil.which("flowrun"))
pass


@pytest.mark.integration_test
@pytest.mark.skipif(not shutil.which("flowrun"), reason="flowrun not available")
def test_flowrunner_will_raise_when_flow_fails(source_root):
shutil.copy(
source_root / "test-data/ert/eclipse/SPE1_ERROR.DATA", "SPE1_ERROR.DATA"
Expand All @@ -42,6 +53,7 @@ def test_flowrunner_will_raise_when_flow_fails(source_root):


@pytest.mark.integration_test
@pytest.mark.skipif(not shutil.which("flowrun"), reason="flowrun not available")
def test_flowrunner_will_can_ignore_flow_errors(source_root):
shutil.copy(
source_root / "test-data/ert/eclipse/SPE1_ERROR.DATA", "SPE1_ERROR.DATA"
Expand All @@ -52,6 +64,7 @@ def test_flowrunner_will_can_ignore_flow_errors(source_root):


@pytest.mark.integration_test
@pytest.mark.skipif(not shutil.which("flowrun"), reason="flowrun not available")
def test_flowrunner_will_raise_on_unknown_version():
with pytest.raises(CalledProcessError):
run_reservoirsimulator.RunReservoirSimulator(
Expand All @@ -60,6 +73,7 @@ def test_flowrunner_will_raise_on_unknown_version():


@pytest.mark.integration_test
@pytest.mark.skipif(not shutil.which("flowrun"), reason="flowrun not available")
def test_flow_with_parallel_keyword(source_root):
"""This only tests that ERT will be able to start flow on a data deck with
the PARALLEL keyword present. It does not assert anything regarding whether
Expand Down

0 comments on commit 1fa5ed6

Please sign in to comment.