Skip to content

Commit 30ebdf9

Browse files
committed
TST: explicitly close the all the figures after each test
1 parent 3eeb476 commit 30ebdf9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/testing/conftest.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ def mpl_test_settings(request):
5454
style, = style_marker.args
5555

5656
matplotlib.testing.setup()
57+
# This import must come after setup() so it doesn't load the
58+
# default backend prematurely.
59+
import matplotlib.pyplot as plt
5760
if backend is not None:
58-
# This import must come after setup() so it doesn't load the
59-
# default backend prematurely.
60-
import matplotlib.pyplot as plt
6161
try:
6262
plt.switch_backend(backend)
6363
except ImportError as exc:
@@ -73,10 +73,12 @@ def mpl_test_settings(request):
7373
try:
7474
yield
7575
finally:
76+
plt.close('all')
7677
if backend is not None:
7778
plt.switch_backend(prev_backend)
7879

7980

81+
8082
@pytest.fixture
8183
def mpl_image_comparison_parameters(request, extension):
8284
# This fixture is applied automatically by the image_comparison decorator.

0 commit comments

Comments
 (0)