Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed input file paths in template for rms script to be generated #747

Merged
merged 4 commits into from
Oct 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions tests/test_field_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,6 @@ def test_get_specification(
)
def test_main(tmp_path, config_file, config_dict, print_info=True):
import subprocess
import sys

# First make an ensemble to be used as testdata. This is based on the config_dict
_, ens_path, result_path, ert_config_path, _ = make_test_case(tmp_path, config_dict)
Expand All @@ -892,18 +891,15 @@ def test_main(tmp_path, config_file, config_dict, print_info=True):
result_path = ens_path / RESULT_PATH

rms_load_script = result_path / RMS_LOAD_SCRIPT_NAME
# Run the main script as a subprocess
script_name = Path(__file__).absolute().parent.parent / Path(
"src/subscript/field_statistics/field_statistics.py"
)
if print_info:
print(f"\nRun script: {script_name}")

# Run the main script as a subprocess,but first clean up
# result directory to be sure this test does not re-use
# previous results from previous tests
remove_file_path = result_path / Path("ertbox--*.roff")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed. tmp_path will always be a new path every time the test is initiated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can remove the subprocess to clean up then.

subprocess.run(["rm", "-f", remove_file_path])
subprocess.run(
[
sys.executable,
script_name.as_posix(),
"field_statistics",
"-c",
config_path.as_posix(),
"-p",
Expand Down