Skip to content

Commit c646892

Browse files
committed
adding skipif to the numpy test, removing cache_dir from the test
1 parent f6b738a commit c646892

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import numpy as np
22
import typing as ty
3-
import os
3+
import importlib
44
import pytest
55

66
from ..submitter import Submitter
77
from ..core import Workflow
88
from ...mark import task, annotate
99

10+
if importlib.util.find_spec("numpy") is None:
11+
pytest.skip("can't find numpy library", allow_module_level=True)
12+
1013

1114
@task
1215
@annotate({"return": {"b": ty.Any}})
@@ -16,12 +19,11 @@ def arrayout(val):
1619

1720
def test_multiout(plugin):
1821
""" testing a simple function that returns a numpy array"""
19-
cache_dir = os.path.join(os.getcwd(), "cache3")
20-
wf = Workflow("wf", input_spec=["val"], val=[0, 1, 2], cache_dir=cache_dir)
21-
wf.add(arrayout(name="mo", val=wf.lzin.val, cache_dir=cache_dir))
22+
wf = Workflow("wf", input_spec=["val"], val=[0, 1, 2])
23+
wf.add(arrayout(name="mo", val=wf.lzin.val))
2224
wf.mo.split("val").combine("val")
2325

24-
wf.set_output([("b", wf.mo.lzout.b)])
26+
wf.set_output([("array", wf.mo.lzout.b)])
2527

2628
with Submitter(plugin=plugin, n_procs=2) as sub:
2729
sub(runnable=wf)
@@ -30,4 +32,4 @@ def test_multiout(plugin):
3032

3133
assert results[0] == {"wf.val": [0, 1, 2]}
3234
for el in range(3):
33-
assert np.array_equal(results[1].output.b[el], np.array([el, el]))
35+
assert np.array_equal(results[1].output.array[el], np.array([el, el]))

0 commit comments

Comments
 (0)