| 28 | |
| 29 | @pytest.mark.backend('QtAgg', skip_on_importerror=True) |
| 30 | def test_fig_close(): |
| 31 | |
| 32 | # save the state of Gcf.figs |
| 33 | init_figs = copy.copy(Gcf.figs) |
| 34 | |
| 35 | # make a figure using pyplot interface |
| 36 | fig = plt.figure() |
| 37 | |
| 38 | # simulate user clicking the close button by reaching in |
| 39 | # and calling close on the underlying Qt object |
| 40 | fig.canvas.manager.window.close() |
| 41 | |
| 42 | # assert that we have removed the reference to the FigureManager |
| 43 | # that got added by plt.figure() |
| 44 | assert init_figs == Gcf.figs |
| 45 | |
| 46 | |
| 47 | @pytest.mark.parametrize( |