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: improve state cleanup in test fixture #366

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/test_image_comp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from copy import deepcopy

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -11,8 +13,10 @@
@pytest.fixture
def tmp_mpl_state():
# reset matplotlib's state when the test is over
style = mpl.rcParams.copy()
style = deepcopy(mpl.rcParams)
yield
for k in set(mpl.rcParams.keys()) - set(style.keys()):
mpl.rcParams.pop(k)
mpl.rcParams.update(style)


Expand Down