From cd9b77e03d5a4810ec131af7682e3869a2abd70b Mon Sep 17 00:00:00 2001 From: Greg Pauloski <18683347+gpauloski@users.noreply.github.com> Date: Mon, 27 Oct 2025 17:39:48 -0700 Subject: [PATCH] Shutdown parsl executors in tests --- tests/executor/parsl_test.py | 11 +++++++---- tests/run/config_test.py | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/executor/parsl_test.py b/tests/executor/parsl_test.py index 71ae8985..3fbcad58 100644 --- a/tests/executor/parsl_test.py +++ b/tests/executor/parsl_test.py @@ -46,8 +46,8 @@ def mock_monitoring() -> Generator[mock.MagicMock, None, None]: def test_get_local_executor(tmp_path: pathlib.Path) -> None: run_dir = str(tmp_path / 'parsl') config = ParslLocalConfig(run_dir=run_dir) - executor = config.get_executor() - assert isinstance(executor, Executor) + with config.get_executor() as executor: + assert isinstance(executor, Executor) def test_get_htex_executor(tmp_path: pathlib.Path, mock_monitoring) -> None: @@ -197,9 +197,12 @@ def test_htex_config() -> None: worker_port_range=[0, 0], interchange_port_range=[0, 0], ) - assert isinstance(config.get_executor(), HighThroughputExecutor) + + with config.get_executor() as executor: + assert isinstance(executor, HighThroughputExecutor) def test_htex_config_default() -> None: config = HTExConfig() - assert isinstance(config.get_executor(), HighThroughputExecutor) + with config.get_executor() as executor: + assert isinstance(executor, HighThroughputExecutor) diff --git a/tests/run/config_test.py b/tests/run/config_test.py index 14511d37..ef2cf91b 100644 --- a/tests/run/config_test.py +++ b/tests/run/config_test.py @@ -144,4 +144,5 @@ def test_read_parsl_htex_config(tmp_path: pathlib.Path) -> None: config.engine.executor.htex, # type: ignore[attr-defined] 'get_executor', ): - config.engine.executor.get_executor() + with config.engine.executor.get_executor(): + pass