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 @@ -215,14 +215,15 @@ def test_figureoptions():
215215
216216
217217@pytest .mark .backend ('QtAgg' , skip_on_importerror = True )
218- def test_save_figure_return ():
218+ def test_save_figure_return (tmp_path ):
219219 fig , ax = plt .subplots ()
220220 ax .imshow ([[1 ]])
221+ expected = tmp_path / "foobar.png"
221222 prop = "matplotlib.backends.qt_compat.QtWidgets.QFileDialog.getSaveFileName"
222- with mock .patch (prop , return_value = ("foobar.png" , None )):
223+ with mock .patch (prop , return_value = (str ( expected ) , None )):
223224 fname = fig .canvas .manager .toolbar .save_figure ()
224- os . remove ( "foobar.png" )
225- assert fname == "foobar.png"
225+ assert fname == str ( expected )
226+ assert expected . exists ()
226227 with mock .patch (prop , return_value = (None , None )):
227228 fname = fig .canvas .manager .toolbar .save_figure ()
228229 assert fname is None
You can’t perform that action at this time.
0 commit comments