Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Removing unnecessary cleanup decorator #2023

Merged
merged 1 commit into from
Mar 26, 2022

Conversation

greglucas
Copy link
Contributor

This removes the Matplotlib cleanup decorator as we are already handling the cleanup with the autouse fixture.

@pytest.fixture(autouse=True)
def mpl_test_cleanup(request):
"""Runs tests in a context manager and closes figures after each test"""
try:
# Run each test in a context manager so that state does not leak out
orig_backend = plt.get_backend()
plt.switch_backend('Agg')
with plt.rc_context():
yield
finally:
# Closes all open figures and switches backend back to original
plt.switch_backend(orig_backend)

closes #2020

This removes the Matplotlib cleanup decorator as we are already handling
the cleanup with the autouse fixture.
@greglucas
Copy link
Contributor Author

Test failures are all unrelated.

@greglucas greglucas merged commit c9be040 into SciTools:main Mar 26, 2022
@greglucas greglucas deleted the test-cleanup branch March 26, 2022 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vendor test decorator from MPL?
2 participants