@@ -680,25 +680,23 @@ def func1(in1):
680680 assert not error_raised
681681
682682
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 ))
687685
688686 for graph in ('orig' , 'flat' , 'exec' , 'hierarchical' , 'colored' ):
689687 for simple in (True , False ):
690688 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' )
693691 pipe .connect ([(mod1 , mod2 , [('output1' , 'input1' )])])
694692 try :
695693 pipe .write_graph (graph2use = graph , simple_form = simple )
696694 except Exception :
697- yield assert_true , False , \
698- 'Failed to plot {} {} graph' .format (
695+ assert False , \
696+ 'Failed to plot {} {} graph' .format (
699697 'simple' if simple else 'detailed' , graph )
700698
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' )
702700 try :
703701 os .remove ('graph.dot' )
704702 except OSError :
@@ -708,13 +706,9 @@ def test_write_graph_runs():
708706 except OSError :
709707 pass
710708
711- os .chdir (cwd )
712- rmtree (wd )
713709
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 ))
718712
719713 for graph in ('orig' , 'flat' , 'exec' , 'hierarchical' , 'colored' ):
720714 for simple in (True , False ):
@@ -724,16 +718,16 @@ def test_deep_nested_write_graph_runs():
724718 sub = pe .Workflow (name = 'pipe_nest_{}' .format (depth ))
725719 parent .add_nodes ([sub ])
726720 parent = sub
727- mod1 = pe .Node (interface = TestInterface (), name = 'mod1' )
721+ mod1 = pe .Node (interface = EngineTestInterface (), name = 'mod1' )
728722 parent .add_nodes ([mod1 ])
729723 try :
730724 pipe .write_graph (graph2use = graph , simple_form = simple )
731725 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 (
734728 'simple' if simple else 'detailed' , graph , e )
735729
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' )
737731 try :
738732 os .remove ('graph.dot' )
739733 except OSError :
@@ -742,6 +736,3 @@ def test_deep_nested_write_graph_runs():
742736 os .remove ('graph_detailed.dot' )
743737 except OSError :
744738 pass
745-
746- os .chdir (cwd )
747- rmtree (wd )
0 commit comments