Skip to content

Commit

Permalink
Add slurm+cluster option value error unit test
Browse files Browse the repository at this point in the history
Added a unit test to assert that a `ValueError` is raised when the
`--slurm` flag is provided and the `--cluster` flag is not.
  • Loading branch information
TimothyWillard committed Nov 7, 2024
1 parent aabc6e4 commit aa3564f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions flepimop/gempyor_pkg/tests/batch/test__click_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,31 @@ def test_only_slurm_batch_system_supported_not_implemented_error(
str(result.exception)
== "The `flepimop batch` CLI only supports batch submission to slurm."
)


def test_cluster_required_for_slurm_value_error(tmp_path: Path) -> None:
config_file = tmp_path / "config.yml"
with config_file.open(mode="w") as f:
yaml.dump({"inference": {"method": "emcee"}}, f)

runner = CliRunner()
result = runner.invoke(
_click_batch,
[
"--slurm",
"--simulations",
"1",
"--jobs",
"1",
"--blocks",
"1",
str(config_file.absolute()),
],
)

assert result.exit_code == 1
assert isinstance(result.exception, ValueError)
assert (
str(result.exception)
== "When submitting a batch job to slurm a cluster is required."
)

0 comments on commit aa3564f

Please sign in to comment.