From 488ff0119b4bbe708c6431f8c7baefdc6d77b254 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Fri, 14 Jun 2019 15:08:04 +0100 Subject: [PATCH] Fix Django warning in tests --- graphene_django/tests/test_types.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py index f7e41bf..c1ac6c2 100644 --- a/graphene_django/tests/test_types.py +++ b/graphene_django/tests/test_types.py @@ -1,3 +1,4 @@ +from collections import OrderedDict, defaultdict from textwrap import dedent import pytest @@ -239,7 +240,11 @@ class TestDjangoObjectType: choices=((1, "Kind of cute"), (2, "Pretty cute"), (3, "OMG SO CUTE!!!")) ) - return PetModel + yield PetModel + + # Clear Django model cache so we don't get warnings when creating the + # model multiple times + PetModel._meta.apps.all_models = defaultdict(OrderedDict) def test_django_objecttype_convert_choices_enum_false(self, PetModel): class Pet(DjangoObjectType):