Skip to content

Commit

Permalink
chore: keep deprecation warner
Browse files Browse the repository at this point in the history
  • Loading branch information
erikwrede committed Sep 29, 2024
1 parent 8ece5ec commit d94d568
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion graphene/types/field.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import inspect
import warnings
from collections.abc import Mapping
from functools import partial

Expand All @@ -8,7 +9,6 @@
from .structures import NonNull
from .unmountedtype import UnmountedType
from .utils import get_type
from ..utils.deprecated import warn_deprecation

base_type = type

Expand Down Expand Up @@ -124,6 +124,7 @@ def wrap_resolve(self, parent_resolver):
(parent_resolver) if the Field definition has no resolver.
"""
if self.get_resolver is not None:
warnings.warn()
warn_deprecation(
"The get_resolver method is being deprecated, please rename it to wrap_resolve."
)
Expand Down
5 changes: 5 additions & 0 deletions graphene/utils/deprecated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from warnings import warn


def warn_deprecation(text: str):
warn(text, category=DeprecationWarning, stacklevel=2)
11 changes: 11 additions & 0 deletions graphene/utils/tests/test_deprecated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from .. import deprecated
from ..deprecated import warn_deprecation


def test_warn_deprecation(mocker):
mocker.patch.object(deprecated.warnings, "warn")

warn_deprecation("OH!")
deprecated.warnings.warn.assert_called_with(
"OH!", stacklevel=2, category=DeprecationWarning
)

0 comments on commit d94d568

Please sign in to comment.