Skip to content

Commit

Permalink
Free test figures after use
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoRoth authored and BtbN committed Aug 20, 2024
1 parent 7580f19 commit 8485ccc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/subtests/subtest/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ def bar(height, **kwargs):
return fig


def _free_fig(func):
@wraps(func)
def free_wrapper(*args, **kwargs):
fig = func(*args, **kwargs)
plt.close(fig)
return fig
return free_wrapper


def figure_test(test_function, **kwargs):
@_free_fig
@pytest.mark.image
@pytest.mark.hash
@pytest.mark.mpl_image_compare(savefig_kwargs={'metadata': {'Software': None}}, **kwargs)
Expand Down

0 comments on commit 8485ccc

Please sign in to comment.