diff --git a/docs/conf.py b/docs/conf.py index 5f8378c..8486e1f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,13 +30,10 @@ html_static_path = ["_static"] -on_rtd = os.environ.get("READTHEDOCS", None) == "True" -if not on_rtd: - # Import and set the theme if we're building docs locally - import sphinx_rtd_theme +# Import and set the theme if we're building docs locally +import sphinx_rtd_theme - html_theme = "sphinx_rtd_theme" - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] +html_theme = "sphinx_rtd_theme" # Autodoc options autodoc_member_order = "groupwise" diff --git a/src/pyhepmc/_deprecated.py b/src/pyhepmc/_deprecated.py index dc788e7..3f3809f 100644 --- a/src/pyhepmc/_deprecated.py +++ b/src/pyhepmc/_deprecated.py @@ -14,13 +14,10 @@ def __init__(self, reason: str, removal: str = ""): self.removal = Version(removal) if removal else None def __call__(self, func: Callable[..., Any]) -> Callable[..., Any]: - category: Any = FutureWarning + category: Any = DeprecationWarning extra = "" - if self.removal: - vstring = ".".join(str(x) for x in self.removal) - extra = f" and will be removed in version {vstring}" - if CURRENT_VERSION >= self.removal: - category = DeprecationWarning + if self.removal and CURRENT_VERSION < self.removal: + extra = f" and will be removed in version {self.removal}" msg = f"{func.__name__} is deprecated{extra}: {self.reason}" def decorated_func(*args: Any, **kwargs: Any) -> Any: diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py index 3389aee..bf0d171 100644 --- a/tests/test_deprecated.py +++ b/tests/test_deprecated.py @@ -25,7 +25,7 @@ def bad(self): foo.bar() with pytest.warns( - FutureWarning, - match="bar is deprecated and will be removed in version 1000.0.0: use baz", + DeprecationWarning, + match="foo is deprecated and will be removed in version 1000.0.0: use baz", ): foo.foo()