Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a78249

Browse files
committed
Remove CleanupTestCase, cleanup, and check_freetype_version
1 parent 41e7050 commit 7a78249

File tree

1 file changed

+1
-65
lines changed

1 file changed

+1
-65
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
import shutil
77
import string
88
import sys
9-
import unittest
109
import warnings
1110

1211
from packaging.version import parse as parse_version
1312

1413
import matplotlib.style
1514
import matplotlib.units
1615
import matplotlib.testing
17-
from matplotlib import (_api, _pylab_helpers, cbook, ft2font, pyplot as plt,
18-
ticker)
16+
from matplotlib import _pylab_helpers, cbook, ft2font, pyplot as plt, ticker
1917
from .compare import comparable_formats, compare_images, make_test_filename
2018
from .exceptions import ImageComparisonFailure
2119

@@ -32,68 +30,6 @@ def _cleanup_cm():
3230
plt.close("all")
3331

3432

35-
@_api.deprecated("3.6", alternative="a vendored copy of the existing code, "
36-
"including the private function _cleanup_cm")
37-
class CleanupTestCase(unittest.TestCase):
38-
"""A wrapper for unittest.TestCase that includes cleanup operations."""
39-
@classmethod
40-
def setUpClass(cls):
41-
cls._cm = _cleanup_cm().__enter__()
42-
43-
@classmethod
44-
def tearDownClass(cls):
45-
cls._cm.__exit__(None, None, None)
46-
47-
48-
@_api.deprecated("3.6", alternative="a vendored copy of the existing code, "
49-
"including the private function _cleanup_cm")
50-
def cleanup(style=None):
51-
"""
52-
A decorator to ensure that any global state is reset before
53-
running a test.
54-
55-
Parameters
56-
----------
57-
style : str, dict, or list, optional
58-
The style(s) to apply. Defaults to ``["classic",
59-
"_classic_test_patch"]``.
60-
"""
61-
62-
# If cleanup is used without arguments, *style* will be a callable, and we
63-
# pass it directly to the wrapper generator. If cleanup if called with an
64-
# argument, it is a string naming a style, and the function will be passed
65-
# as an argument to what we return. This is a confusing, but somewhat
66-
# standard, pattern for writing a decorator with optional arguments.
67-
68-
def make_cleanup(func):
69-
if inspect.isgeneratorfunction(func):
70-
@functools.wraps(func)
71-
def wrapped_callable(*args, **kwargs):
72-
with _cleanup_cm(), matplotlib.style.context(style):
73-
yield from func(*args, **kwargs)
74-
else:
75-
@functools.wraps(func)
76-
def wrapped_callable(*args, **kwargs):
77-
with _cleanup_cm(), matplotlib.style.context(style):
78-
func(*args, **kwargs)
79-
80-
return wrapped_callable
81-
82-
if callable(style):
83-
result = make_cleanup(style)
84-
# Default of mpl_test_settings fixture and image_comparison too.
85-
style = ["classic", "_classic_test_patch"]
86-
return result
87-
else:
88-
return make_cleanup
89-
90-
91-
@_api.deprecated("3.6", alternative="a vendored copy of the existing code "
92-
"of _check_freetype_version")
93-
def check_freetype_version(ver):
94-
return _check_freetype_version(ver)
95-
96-
9733
def _check_freetype_version(ver):
9834
if ver is None:
9935
return True

0 commit comments

Comments
 (0)