We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc49cee commit ee0bc9dCopy full SHA for ee0bc9d
1 file changed
lib/matplotlib/tests/test_backend_qt.py
@@ -219,14 +219,15 @@ def test_figureoptions():
219
220
221
@pytest.mark.backend('QtAgg', skip_on_importerror=True)
222
-def test_save_figure_return():
+def test_save_figure_return(tmp_path):
223
+ os.chdir(tmp_path)
224
fig, ax = plt.subplots()
225
ax.imshow([[1]])
226
prop = "matplotlib.backends.qt_compat.QtWidgets.QFileDialog.getSaveFileName"
227
with mock.patch(prop, return_value=("foobar.png", None)):
228
fname = fig.canvas.manager.toolbar.save_figure()
- os.remove("foobar.png")
229
assert fname == "foobar.png"
230
+ assert (tmp_path / "foobar.png").exists()
231
with mock.patch(prop, return_value=(None, None)):
232
233
assert fname is None
0 commit comments