Skip to content

Commit

Permalink
Add test for wrong config types
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Oct 25, 2023
1 parent d524913 commit 2601536
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/unit_tests/config/test_queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
import pytest
from hypothesis import given

from ert.config import (
ConfigValidationError,
ErtConfig,
QueueConfig,
QueueSystem,
)
from ert.config import ConfigValidationError, ErtConfig, QueueConfig, QueueSystem
from ert.job_queue import Driver


Expand Down Expand Up @@ -208,3 +203,20 @@ def test_initializing_empty_config_values(queue_system, queue_system_option):
assert driver.get_option("MAX_RUNNING") == "0"
for options in config_object.queue_config.queue_options[queue_system]:
assert isinstance(options, tuple)


@pytest.mark.usefixtures("use_tmpdir")
@pytest.mark.parametrize(
"queue_system, queue_system_option",
[("LSF", "LSF_SERVER")],
)
def test_wrong_config_types(queue_system, queue_system_option):
filename = "config.ert"
with open(filename, "w", encoding="utf-8") as f:
f.write("NUM_REALIZATIONS 1\n")
f.write(f"QUEUE_SYSTEM {queue_system}\n")
f.write(f"QUEUE_OPTION {queue_system} {queue_system_option}\n")
f.write(f"QUEUE_OPTION {queue_system} SUBMIT_SLEEP nan\n")

with pytest.raises(ConfigValidationError, match="is not valid positive integer"):
ErtConfig.from_file(filename)

0 comments on commit 2601536

Please sign in to comment.