Skip to content

Commit 8b1e15e

Browse files
authored
Merge pull request #46 from gshiba/close-fig
Close figure after saving
2 parents b9e3577 + 40a0b51 commit 8b1e15e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pytest_mpl/plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def item_function_wrapper(*args, **kwargs):
172172
test_image = os.path.abspath(os.path.join(result_dir, filename))
173173

174174
fig.savefig(test_image, **savefig_kwargs)
175+
plt.close(fig)
175176

176177
# Find path to baseline image
177178
if baseline_remote:
@@ -202,6 +203,7 @@ def item_function_wrapper(*args, **kwargs):
202203
os.makedirs(self.generate_dir)
203204

204205
fig.savefig(os.path.abspath(os.path.join(self.generate_dir, filename)), **savefig_kwargs)
206+
plt.close(fig)
205207
pytest.skip("Skipping test, since generating data")
206208

207209
if item.cls is not None:

0 commit comments

Comments
 (0)