Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Nov 6, 2024
1 parent 10ffbf3 commit c6c6b2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion executorlib/standalone/inputcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def check_pysqa_config_directory(pysqa_config_directory: Optional[str]) -> None:
)


def validate_number_of_cores(max_cores: int, max_workers: int) -> int:
def validate_number_of_cores(max_cores: Optional[int], max_workers: Optional[int]) -> int:
"""
Validate the number of cores and return the appropriate value.
"""
Expand Down
10 changes: 8 additions & 2 deletions tests/test_shared_input_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
check_max_workers_and_cores,
check_hostname_localhost,
check_pysqa_config_directory,
validate_number_of_cores,
)


Expand Down Expand Up @@ -80,9 +81,9 @@ def test_check_flux_executor_pmi_mode(self):

def test_check_max_workers_and_cores(self):
with self.assertRaises(ValueError):
check_max_workers_and_cores(max_workers=2, max_cores=1)
check_max_workers_and_cores(max_workers=2, max_cores=None)
with self.assertRaises(ValueError):
check_max_workers_and_cores(max_workers=1, max_cores=2)
check_max_workers_and_cores(max_workers=None, max_cores=2)
with self.assertRaises(ValueError):
check_max_workers_and_cores(max_workers=2, max_cores=2)

Expand All @@ -95,3 +96,8 @@ def test_check_hostname_localhost(self):
def test_check_pysqa_config_directory(self):
with self.assertRaises(ValueError):
check_pysqa_config_directory(pysqa_config_directory="path/to/config")

def test_validate_number_of_cores(self):
self.assertIsInstance(validate_number_of_cores(max_cores=None, max_workers=None), int)
self.assertIsInstance(validate_number_of_cores(max_cores=1, max_workers=None), int)
self.assertIsInstance(validate_number_of_cores(max_cores=None, max_workers=1), int)

0 comments on commit c6c6b2e

Please sign in to comment.