@@ -115,12 +115,13 @@ def test_flow_of_jobs_init():
115115
116116 # test job given rather than outputs
117117 add_job = get_test_job ()
118- with pytest .warns (UserWarning ):
118+ warn_msg = "Flow 'Flow' contains a Flow or Job as an output."
119+ with pytest .warns (UserWarning , match = warn_msg ):
119120 Flow ([add_job ], output = add_job )
120121
121122 # test complex object containing job given rather than outputs
122123 add_job = get_test_job ()
123- with pytest .warns (UserWarning ):
124+ with pytest .warns (UserWarning , match = warn_msg ):
124125 Flow ([add_job ], output = {1 : [[{"a" : add_job }]]})
125126
126127 # test job already belongs to another flow
@@ -203,13 +204,14 @@ def test_flow_of_flows_init():
203204 # test flow given rather than outputs
204205 add_job = get_test_job ()
205206 sub_flow = Flow ([add_job ], output = add_job .output )
206- with pytest .warns (UserWarning ):
207+ warn_msg = "Flow 'Flow' contains a Flow or Job as an output."
208+ with pytest .warns (UserWarning , match = warn_msg ):
207209 Flow ([sub_flow ], output = sub_flow )
208210
209211 # test complex object containing job given rather than outputs
210212 add_job = get_test_job ()
211213 sub_flow = Flow ([add_job ], output = add_job .output )
212- with pytest .warns (UserWarning ):
214+ with pytest .warns (UserWarning , match = warn_msg ):
213215 Flow ([sub_flow ], output = {1 : [[{"a" : sub_flow }]]})
214216
215217 # test flow already belongs to another flow
@@ -354,6 +356,8 @@ def test_graph():
354356
355357
356358def test_draw_graph ():
359+ pytest .importorskip ("matplotlib" )
360+
357361 from jobflow import Flow , JobOrder
358362
359363 # test unconnected graph
@@ -383,8 +387,9 @@ def test_draw_graph():
383387 assert flow .draw_graph ()
384388
385389
386- @pytest .mark .usefixtures ("no_pydot" )
387- def test_draw_graph_nopydot ():
390+ def test_draw_graph_nopydot (no_pydot ):
391+ pytest .importorskip ("matplotlib" )
392+
388393 from jobflow import Flow , JobOrder
389394
390395 # test unconnected graph
@@ -714,7 +719,7 @@ def test_add_jobs():
714719 flow2 = Flow ([flow1 ])
715720 flow3 = Flow ([flow2 ])
716721 with pytest .raises (
717- ValueError , match = "circular dependency: Flow .+ contains the current Flow"
722+ ValueError , match = r "circular dependency: Flow .+ contains the current Flow"
718723 ):
719724 flow1 .add_jobs (flow3 )
720725
@@ -1312,7 +1317,7 @@ def test_flow_magic_methods_edge_cases():
13121317 ):
13131318 _ = flow1 + job1
13141319
1315- with pytest .raises (ValueError , match = "Job .+ already belongs to another flow" ):
1320+ with pytest .raises (ValueError , match = r "Job .+ already belongs to another flow" ):
13161321 _ = flow1 + job6
13171322
13181323
0 commit comments