File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -219,14 +219,15 @@ def test_figureoptions():
219219
220220
221221@pytest .mark .backend ('QtAgg' , skip_on_importerror = True )
222- def test_save_figure_return ():
222+ def test_save_figure_return (tmp_path ):
223223 fig , ax = plt .subplots ()
224224 ax .imshow ([[1 ]])
225+ expected = tmp_path / "foobar.png"
225226 prop = "matplotlib.backends.qt_compat.QtWidgets.QFileDialog.getSaveFileName"
226- with mock .patch (prop , return_value = ("foobar.png" , None )):
227+ with mock .patch (prop , return_value = (str ( expected ) , None )):
227228 fname = fig .canvas .manager .toolbar .save_figure ()
228- os . remove ( "foobar.png" )
229- assert fname == "foobar.png"
229+ assert fname == str ( expected )
230+ assert expected . exists ()
230231 with mock .patch (prop , return_value = (None , None )):
231232 fname = fig .canvas .manager .toolbar .save_figure ()
232233 assert fname is None
You can’t perform that action at this time.
0 commit comments