@@ -680,25 +680,23 @@ def func1(in1):
680
680
assert not error_raised
681
681
682
682
683
- def test_write_graph_runs ():
684
- cwd = os .getcwd ()
685
- wd = mkdtemp ()
686
- os .chdir (wd )
683
+ def test_write_graph_runs (tmpdir ):
684
+ os .chdir (str (tmpdir ))
687
685
688
686
for graph in ('orig' , 'flat' , 'exec' , 'hierarchical' , 'colored' ):
689
687
for simple in (True , False ):
690
688
pipe = pe .Workflow (name = 'pipe' )
691
- mod1 = pe .Node (interface = TestInterface (), name = 'mod1' )
692
- mod2 = pe .Node (interface = TestInterface (), name = 'mod2' )
689
+ mod1 = pe .Node (interface = EngineTestInterface (), name = 'mod1' )
690
+ mod2 = pe .Node (interface = EngineTestInterface (), name = 'mod2' )
693
691
pipe .connect ([(mod1 , mod2 , [('output1' , 'input1' )])])
694
692
try :
695
693
pipe .write_graph (graph2use = graph , simple_form = simple )
696
694
except Exception :
697
- yield assert_true , False , \
698
- 'Failed to plot {} {} graph' .format (
695
+ assert False , \
696
+ 'Failed to plot {} {} graph' .format (
699
697
'simple' if simple else 'detailed' , graph )
700
698
701
- yield assert_true , os .path .exists ('graph.dot' ) or os .path .exists ('graph_detailed.dot' )
699
+ assert os .path .exists ('graph.dot' ) or os .path .exists ('graph_detailed.dot' )
702
700
try :
703
701
os .remove ('graph.dot' )
704
702
except OSError :
@@ -708,13 +706,9 @@ def test_write_graph_runs():
708
706
except OSError :
709
707
pass
710
708
711
- os .chdir (cwd )
712
- rmtree (wd )
713
709
714
- def test_deep_nested_write_graph_runs ():
715
- cwd = os .getcwd ()
716
- wd = mkdtemp ()
717
- os .chdir (wd )
710
+ def test_deep_nested_write_graph_runs (tmpdir ):
711
+ os .chdir (str (tmpdir ))
718
712
719
713
for graph in ('orig' , 'flat' , 'exec' , 'hierarchical' , 'colored' ):
720
714
for simple in (True , False ):
@@ -724,16 +718,16 @@ def test_deep_nested_write_graph_runs():
724
718
sub = pe .Workflow (name = 'pipe_nest_{}' .format (depth ))
725
719
parent .add_nodes ([sub ])
726
720
parent = sub
727
- mod1 = pe .Node (interface = TestInterface (), name = 'mod1' )
721
+ mod1 = pe .Node (interface = EngineTestInterface (), name = 'mod1' )
728
722
parent .add_nodes ([mod1 ])
729
723
try :
730
724
pipe .write_graph (graph2use = graph , simple_form = simple )
731
725
except Exception as e :
732
- yield assert_true , False , \
733
- 'Failed to plot {} {} deep graph: {!s}' .format (
726
+ assert False , \
727
+ 'Failed to plot {} {} deep graph: {!s}' .format (
734
728
'simple' if simple else 'detailed' , graph , e )
735
729
736
- yield assert_true , os .path .exists ('graph.dot' ) or os .path .exists ('graph_detailed.dot' )
730
+ assert os .path .exists ('graph.dot' ) or os .path .exists ('graph_detailed.dot' )
737
731
try :
738
732
os .remove ('graph.dot' )
739
733
except OSError :
@@ -742,6 +736,3 @@ def test_deep_nested_write_graph_runs():
742
736
os .remove ('graph_detailed.dot' )
743
737
except OSError :
744
738
pass
745
-
746
- os .chdir (cwd )
747
- rmtree (wd )
0 commit comments