Skip to content

Commit

Permalink
Update tests/test_dependencies_executor.py
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
jan-janssen and coderabbitai[bot] authored Feb 15, 2025
1 parent 41922d8 commit 04174e7
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions tests/test_dependencies_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,34 +331,33 @@ def test_block_allocation_true_two_workers_loop(self):


class TestInfo(unittest.TestCase):
"""Test cases for the info property of SingleNodeExecutor."""

def setUp(self):
"""Set up the expected info dictionary."""
self.expected_info = {
'cores': 1,
'cwd': None,
'openmpi_oversubscribe': False,
'cache_directory': None,
'hostname_localhost': None,
'spawner': MpiExecSpawner,
'max_cores': None,
'max_workers': None,
}

def test_info_disable_dependencies_true(self):
"""Test info property with dependencies disabled."""
with SingleNodeExecutor(disable_dependencies=True) as exe:
self.assertEqual(
exe.info,
{
'cores': 1,
'cwd': None,
'openmpi_oversubscribe': False,
'cache_directory': None,
'hostname_localhost': None,
'spawner': MpiExecSpawner,
'max_cores': None,
'max_workers': None,
}
)
self.assertEqual(exe.info, self.expected_info)

def test_info_disable_dependencies_false(self):
"""Test info property with dependencies enabled."""
with SingleNodeExecutor(disable_dependencies=False) as exe:
self.assertEqual(
exe.info,
{
'cores': 1,
'cwd': None,
'openmpi_oversubscribe': False,
'cache_directory': None,
'hostname_localhost': None,
'spawner': MpiExecSpawner,
'max_cores': None,
'max_workers': None,
}
)
self.assertEqual(exe.info, self.expected_info)

def test_info_error_handling(self):
"""Test info property error handling when executor is not running."""
exe = SingleNodeExecutor()
with self.assertRaises(Exception):
_ = exe.info

0 comments on commit 04174e7

Please sign in to comment.