Skip to content

Commit

Permalink
TST: improve state cleanup in test fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Nov 2, 2024
1 parent 3002b83 commit 13d9bcb
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit 13d9bcb

Please sign in to comment.