Skip to content

Commit

Permalink
Mypy fixes and Mock to specify spec
Browse files Browse the repository at this point in the history
  • Loading branch information
yadudoc committed Feb 21, 2024
1 parent d28e6d7 commit 9fc1ac5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions parsl/providers/slurm/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def submit(self, command: str, tasks_per_node: int, job_name="parsl.slurm") -> s

job_name = "{0}.{1}".format(job_name, time.time())

assert self.script_dir, "Expected script_dir to be set"
script_path = os.path.join(self.script_dir, job_name)
script_path = os.path.abspath(script_path)
job_stdout_path = script_path + ".stdout"
Expand Down
5 changes: 2 additions & 3 deletions parsl/tests/test_providers/test_slurm_template.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import random

import mock
from unittest import mock
import pytest

from parsl.channels import LocalChannel
Expand All @@ -17,12 +17,11 @@ def test_submit_script_basic(tmp_path):
)
provider.script_dir = tmp_path
job_id = str(random.randint(55000, 59000))
provider.execute_wait = mock.MagicMock()
provider.execute_wait = mock.MagicMock(spec=SlurmProvider.execute_wait)
provider.execute_wait.return_value = (0, f"Submitted batch job {job_id}", "")
result_job_id = provider.submit("test", tasks_per_node=1)
assert job_id == result_job_id
provider.execute_wait.assert_called()
logging.warning(f"Got resources: {provider.resources}")
assert job_id in provider.resources

job_info = provider.resources[job_id]
Expand Down

0 comments on commit 9fc1ac5

Please sign in to comment.