Skip to content

Commit

Permalink
Add unit tests for empty job name
Browse files Browse the repository at this point in the history
  • Loading branch information
cmrqs committed Dec 3, 2024
1 parent f4ff605 commit a16d2d0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/ert/unit_tests/scheduler/test_lsf_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,13 @@ async def test_submit_with_resource_requirement_with_bsub_capture():
assert "hname" not in Path("captured_bsub_args").read_text(encoding="utf-8")


@pytest.mark.usefixtures("capturing_bsub")
async def test_empty_job_name():
driver = LsfDriver()
await driver.submit(0, "/bin/sleep")
assert " -J sleep " in Path("captured_bsub_args").read_text(encoding="utf-8")


@pytest.mark.integration_test
@pytest.mark.usefixtures("use_tmpdir")
async def test_submit_with_num_cpu(pytestconfig, job_name):
Expand Down
7 changes: 7 additions & 0 deletions tests/ert/unit_tests/scheduler/test_openpbs_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ async def test_job_name():
assert " -Nsleepy " in Path("captured_qsub_args").read_text(encoding="utf-8")


@pytest.mark.usefixtures("capturing_qsub")
async def test_empty_job_name():
driver = OpenPBSDriver()
await driver.submit(0, "/bin/sleep")
assert " -Nsleep " in Path("captured_qsub_args").read_text(encoding="utf-8")


@pytest.mark.usefixtures("capturing_qsub")
async def test_job_name_with_prefix():
driver = OpenPBSDriver(job_prefix="pre_")
Expand Down
9 changes: 9 additions & 0 deletions tests/ert/unit_tests/scheduler/test_slurm_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ async def test_project_code_is_set(project_code):
)


@pytest.mark.usefixtures("capturing_sbatch")
async def test_empty_job_name():
driver = SlurmDriver()
await driver.submit(0, "/bin/sleep")
assert "--job-name=sleep" in Path("captured_sbatch_args").read_text(
encoding="utf-8"
)


@pytest.mark.usefixtures("capturing_sbatch")
@given(max_runtime=st.floats(min_value=1, max_value=999999999))
async def test_max_runtime_is_properly_formatted(max_runtime):
Expand Down

0 comments on commit a16d2d0

Please sign in to comment.