diff --git a/lib/matplotlib/testing/decorators.py b/lib/matplotlib/testing/decorators.py index f4318569009c..f61b13194700 100644 --- a/lib/matplotlib/testing/decorators.py +++ b/lib/matplotlib/testing/decorators.py @@ -130,7 +130,7 @@ def cleanup(style=None): # writing a decorator with optional arguments. def make_cleanup(func): - if inspect.isgenerator(func): + if inspect.isgeneratorfunction(func): @functools.wraps(func) def wrapped_callable(*args, **kwargs): original_units_registry = matplotlib.units.registry.copy()