Skip to content

Commit

Permalink
Merge pull request matplotlib#6754 from Kojoley/fix-error-handling-in…
Browse files Browse the repository at this point in the history
…-imagecomparisontest

Fixed error handling in `ImageComparisonTest.setup_class`
  • Loading branch information
mdboom committed Jul 16, 2016
1 parent d7af968 commit 416c2a2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/matplotlib/testing/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,14 @@ class ImageComparisonTest(CleanupTest):
@classmethod
def setup_class(cls):
CleanupTest.setup_class()
cls._initial_settings = mpl.rcParams.copy()
try:
matplotlib.style.use(cls._style)
matplotlib.testing.set_font_settings_for_testing()
cls._func()
except:
# Restore original settings before raising errors during the update.
mpl.rcParams.clear()
mpl.rcParams.update(cls._initial_settings)
CleanupTest.teardown_class()
raise
cls.original_settings = cls._initial_settings
matplotlib.testing.set_font_settings_for_testing()
cls._func()

@classmethod
def teardown_class(cls):
Expand Down

0 comments on commit 416c2a2

Please sign in to comment.