Skip to content

Commit

Permalink
Add further unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
giffels committed Dec 18, 2023
1 parent 693a54f commit 2215a4b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Created by changelog.py at 2023-12-16, command
.. Created by changelog.py at 2023-12-18, command
'/Users/giffler/.cache/pre-commit/repor6pnmwlm/py_env-python3.10/bin/changelog docs/source/changes compile --categories Added Changed Fixed Security Deprecated --output=docs/source/changelog.rst'
based on the format of 'https://keepachangelog.com/'
Expand Down
26 changes: 26 additions & 0 deletions tests/adapters_t/sites_t/test_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,32 @@ def test_resource_status_of_completed_jobs_w_raised_exception(self):
'squeue -o "%A|%N|%T" -h -t all --job=1351043'
)

# test that exception is re-raised if two or more job ids are specified,
# since Slurm does not fail in that case.

tasks = [
self.slurm_adapter.resource_status(
AttributeDict(
resource_id="1390065",
remote_resource_uuid="1351043",
),
),
self.slurm_adapter.resource_status(
AttributeDict(
resource_id="1390066",
remote_resource_uuid="1351044",
),
),
]

with self.assertLogs(level=logging.WARNING):
with self.assertRaises(CommandExecutionFailure):
run_async(asyncio.gather, *tasks)

self.mock_executor.return_value.run_command.assert_called_with(
'squeue -o "%A|%N|%T" -h -t all --job=1351043,1351044'
)

@mock_executor_run_command(
stdout="",
raise_exception=CommandExecutionFailure(
Expand Down

0 comments on commit 2215a4b

Please sign in to comment.