From 371a5d2f1d62802ba89ff464801ddd041b61507a Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Dec 2024 22:16:40 -0700 Subject: [PATCH 1/2] test working directory --- tests/test_executor_backend_mpi.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_executor_backend_mpi.py b/tests/test_executor_backend_mpi.py index 618dad74..e0f7684e 100644 --- a/tests/test_executor_backend_mpi.py +++ b/tests/test_executor_backend_mpi.py @@ -1,3 +1,4 @@ +import os import importlib.util import shutil import time @@ -110,3 +111,21 @@ def test_meta_executor_parallel_cache(self): self.assertTrue(fs_2.done()) time_4 = time.time() self.assertTrue(time_3 - time_4 < 1) + + +class TestWorkingDirectory(unittest.TestCase): + def test_output_files_cwd(self): + dirname = os.path.abspath(os.path.dirname(__file__)) + os.makedirs(dirname, exist_ok=True) + with Executor( + max_cores=1, + resource_dict={"cores": 1, "cwd": dirname}, + backend="local", + block_allocation=True, + ) as p: + output = p.map(calc, [1, 2, 3]) + self.assertEqual( + list(output), + [1, 2, 3], + ) + os.rmdir(dirname) From 1bc6902462df3d13cdbf3215a6e9f3246fdb07fa Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Dec 2024 22:19:32 -0700 Subject: [PATCH 2/2] Update test_executor_backend_mpi.py --- tests/test_executor_backend_mpi.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_executor_backend_mpi.py b/tests/test_executor_backend_mpi.py index e0f7684e..3eef78f9 100644 --- a/tests/test_executor_backend_mpi.py +++ b/tests/test_executor_backend_mpi.py @@ -128,4 +128,3 @@ def test_output_files_cwd(self): list(output), [1, 2, 3], ) - os.rmdir(dirname)