Skip to content

Commit

Permalink
Fix INSERT_NOSIM and REMOVE_NOSIM on OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
HakonSohoel committed Jan 28, 2025
1 parent 34eb79b commit 13710e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 13 additions & 1 deletion src/semeio/forward_models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

from ert import (
ForwardModelStepDocumentation,
ForwardModelStepJSON,
Expand Down Expand Up @@ -225,6 +227,14 @@ def __init__(self):
super().__init__(
name="INSERT_NOSIM",
command=[
"sed",
"-i",
"",
"s/^RUNSPEC.*/RUNSPEC\\\\nNOSIM/",
"<ECLBASE>.DATA",
]
if sys.platform == "darwin"
else [
"sed",
"-i",
"s/^RUNSPEC.*/RUNSPEC\\\\nNOSIM/",
Expand All @@ -248,7 +258,9 @@ class RemoveNoSim(ForwardModelStepPlugin):
def __init__(self):
super().__init__(
name="REMOVE_NOSIM",
command=["sed", "-i", "/^NOSIM/d", "<ECLBASE>.DATA"],
command=["sed", "-i", "", "/^NOSIM/d", "<ECLBASE>.DATA"]
if sys.platform == "darwin"
else ["sed", "-i", "/^NOSIM/d", "<ECLBASE>.DATA"],
)

@staticmethod
Expand Down
4 changes: 0 additions & 4 deletions tests/forward_models/nosim/test_nosim.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import os
import shutil
import subprocess
import sys

import pytest


@pytest.mark.skipif(
sys.platform == "darwin", reason="Skip test for Mac OS - invalid use of sed"
)
# The GNU extension for the sed command on osx behaves slightly different.
# The result when running the forward model is as follow:
# cat insert_nosim.stderr.1
Expand Down

0 comments on commit 13710e6

Please sign in to comment.