diff --git a/setup.cfg b/setup.cfg index 20207083..70309431 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,6 +46,7 @@ packages = find: install_requires = Pillow>=8.2.0 coloredlogs>=14.0 # strictly optional + deprecation>=2.1.0 img2pdf>=0.3.0 # pure Python packaging>=20 pdfminer.six!=20200720,>=20191110 diff --git a/src/ocrmypdf/helpers.py b/src/ocrmypdf/helpers.py index 481b2f1b..033f5553 100644 --- a/src/ocrmypdf/helpers.py +++ b/src/ocrmypdf/helpers.py @@ -13,7 +13,6 @@ import warnings from collections import namedtuple from collections.abc import Iterable from contextlib import suppress -from functools import wraps from io import StringIO from math import isclose, isfinite from pathlib import Path @@ -275,20 +274,3 @@ def pikepdf_enable_mmap(): # Fix is not in pybind11 2.6.0 # log.debug("pikepdf mmap disabled") return - - -def deprecated(func): - """Warn that function is deprecated.""" - - @wraps(func) - def new_func(*args, **kwargs): - warnings.simplefilter('always', DeprecationWarning) # turn off filter - warnings.warn( - f"Call to deprecated function {func.__name__}.", - category=DeprecationWarning, - stacklevel=2, - ) - warnings.simplefilter('default', DeprecationWarning) # reset filter - return func(*args, **kwargs) - - return new_func diff --git a/tests/test_helpers.py b/tests/test_helpers.py index bd43b5b5..e1992b32 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -54,15 +54,6 @@ def test_no_cpu_count(monkeypatch): assert invoked, "Patched function called during test" -def test_deprecated(): - @helpers.deprecated - def old_function(): - return 42 - - with pytest.deprecated_call(): - assert old_function() == 42 - - skipif_docker = pytest.mark.skipif(running_in_docker(), reason="fails on Docker")