From 85976ffb1f39e5f7ee72640f737989de28bc0166 Mon Sep 17 00:00:00 2001 From: DoctorJohn Date: Wed, 10 Jun 2020 18:30:24 +0200 Subject: [PATCH] Start raising DeprecationWarnings for using only_fields and exclude_fields (v3) (#980) --- graphene_django/tests/test_types.py | 4 ++-- graphene_django/types.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py index 21ee6ca..3008394 100644 --- a/graphene_django/tests/test_types.py +++ b/graphene_django/tests/test_types.py @@ -263,7 +263,7 @@ def with_local_registry(func): @with_local_registry def test_django_objecttype_only_fields(): - with pytest.warns(PendingDeprecationWarning): + with pytest.warns(DeprecationWarning): class Reporter(DjangoObjectType): class Meta: @@ -320,7 +320,7 @@ def test_django_objecttype_all_fields(): @with_local_registry def test_django_objecttype_exclude_fields(): - with pytest.warns(PendingDeprecationWarning): + with pytest.warns(DeprecationWarning): class Reporter(DjangoObjectType): class Meta: diff --git a/graphene_django/types.py b/graphene_django/types.py index f389421..f00be1c 100644 --- a/graphene_django/types.py +++ b/graphene_django/types.py @@ -194,7 +194,7 @@ class DjangoObjectType(ObjectType): if only_fields: warnings.warn( "Defining `only_fields` is deprecated in favour of `fields`.", - PendingDeprecationWarning, + DeprecationWarning, stacklevel=2, ) fields = only_fields @@ -210,7 +210,7 @@ class DjangoObjectType(ObjectType): if exclude_fields: warnings.warn( "Defining `exclude_fields` is deprecated in favour of `exclude`.", - PendingDeprecationWarning, + DeprecationWarning, stacklevel=2, ) exclude = exclude_fields