Skip to content

Commit 73dca53

Browse files
committed
extend error handling
1 parent 6dd9817 commit 73dca53

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tests/test_cache_fileexecutor_serial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_executor_working_directory(self):
7373
self.assertEqual(fs1.result(), os.listdir(cwd))
7474

7575
def test_executor_error(self):
76-
cwd = os.path.join(os.path.dirname(__file__), "executables")
76+
cwd = os.path.join(os.path.dirname(__file__), "error")
7777
with FileExecutor(
7878
resource_dict={"cwd": cwd}, execute_function=execute_in_subprocess
7979
) as exe:

tests/test_singlenodeexecutor_cache.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
skip_h5py_test = True
1313

1414

15+
def get_error(a):
16+
raise ValueError(a)
17+
18+
1519
@unittest.skipIf(
1620
skip_h5py_test, "h5py is not installed, so the h5io tests are skipped."
1721
)
@@ -28,6 +32,15 @@ def test_cache_data(self):
2832
sum([sum(c["input_args"][0]) for c in cache_lst]), sum(result_lst)
2933
)
3034

35+
def test_cache_error(self):
36+
cache_directory = "./cache_error"
37+
with SingleNodeExecutor(cache_directory=cache_directory) as exe:
38+
f = exe.submit(get_error, a=1)
39+
with self.assertRaises(ValueError):
40+
print(f.result())
41+
3142
def tearDown(self):
3243
if os.path.exists("cache"):
3344
shutil.rmtree("cache")
45+
if os.path.exists("cache_error"):
46+
shutil.rmtree("cache_error")

0 commit comments

Comments
 (0)