Skip to content

Commit 20eca54

Browse files
committed
TEST: Skip PBS test in absence of qsub, use tmp_path fixture
1 parent c37fcfb commit 20eca54

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

nipype/pipeline/plugins/tests/test_pbs.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
import os
3-
from shutil import rmtree
4-
from tempfile import mkdtemp
5-
from time import sleep
2+
from shutil import which
63

74
import nipype.interfaces.base as nib
85
import pytest
@@ -32,22 +29,15 @@ def _list_outputs(self):
3229
return outputs
3330

3431

35-
@pytest.mark.xfail(reason="not known")
36-
def test_run_pbsgraph():
37-
cur_dir = os.getcwd()
38-
temp_dir = mkdtemp(prefix="test_engine_")
39-
os.chdir(temp_dir)
40-
41-
pipe = pe.Workflow(name="pipe")
32+
@pytest.mark.skipif(which('qsub') is None, reason="PBS not installed")
33+
def test_run_pbsgraph(tmp_path):
34+
pipe = pe.Workflow(name="pipe", base_dir=str(tmp_path))
4235
mod1 = pe.Node(interface=PbsTestInterface(), name="mod1")
4336
mod2 = pe.MapNode(interface=PbsTestInterface(), iterfield=["input1"], name="mod2")
4437
pipe.connect([(mod1, mod2, [("output1", "input1")])])
45-
pipe.base_dir = os.getcwd()
4638
mod1.inputs.input1 = 1
4739
execgraph = pipe.run(plugin="PBSGraph")
4840
names = [".".join((node._hierarchy, node.name)) for node in execgraph.nodes()]
4941
node = list(execgraph.nodes())[names.index("pipe.mod1")]
5042
result = node.get_output("output1")
5143
assert result == [1, 1]
52-
os.chdir(cur_dir)
53-
rmtree(temp_dir)

0 commit comments

Comments
 (0)