From 2bf7e7f66daf3f17c0ec8e599a32769eac24d849 Mon Sep 17 00:00:00 2001 From: Paul Hallett Date: Wed, 8 May 2019 22:45:28 +0100 Subject: [PATCH] Fix importing error for GraphQLTestCase --- docs/testing.rst | 2 +- graphene_django/utils/__init__.py | 19 +++++++++++++++++++ .../{tests/base_test.py => utils/testing.py} | 4 +--- graphene_django/{ => utils}/utils.py | 7 ------- 4 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 graphene_django/utils/__init__.py rename graphene_django/{tests/base_test.py => utils/testing.py} (95%) rename graphene_django/{ => utils}/utils.py (96%) diff --git a/docs/testing.rst b/docs/testing.rst index a4d5518..b111642 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -9,7 +9,7 @@ Usage: import json - from graphene_django.tests.base_test import GraphQLTestCase + from graphene_django.utils.testing import GraphQLTestCase from my_project.config.schema import schema class MyFancyTestCase(GraphQLTestCase): diff --git a/graphene_django/utils/__init__.py b/graphene_django/utils/__init__.py new file mode 100644 index 0000000..f9c388d --- /dev/null +++ b/graphene_django/utils/__init__.py @@ -0,0 +1,19 @@ +from .utils import ( + DJANGO_FILTER_INSTALLED, + get_reverse_fields, + maybe_queryset, + get_model_fields, + is_valid_django_model, + import_single_dispatch, +) +from .testing import GraphQLTestCase + +__all__ = [ + "DJANGO_FILTER_INSTALLED", + "get_reverse_fields", + "maybe_queryset", + "get_model_fields", + "is_valid_django_model", + "import_single_dispatch", + "GraphQLTestCase", +] diff --git a/graphene_django/tests/base_test.py b/graphene_django/utils/testing.py similarity index 95% rename from graphene_django/tests/base_test.py rename to graphene_django/utils/testing.py index 84e1dc5..47f8d04 100644 --- a/graphene_django/tests/base_test.py +++ b/graphene_django/utils/testing.py @@ -1,8 +1,6 @@ import json -from django.http import HttpResponse -from django.test import Client -from django.test import TestCase +from django.test import TestCase, Client class GraphQLTestCase(TestCase): diff --git a/graphene_django/utils.py b/graphene_django/utils/utils.py similarity index 96% rename from graphene_django/utils.py rename to graphene_django/utils/utils.py index 532be06..02c47ee 100644 --- a/graphene_django/utils.py +++ b/graphene_django/utils/utils.py @@ -4,13 +4,6 @@ from django.db import models from django.db.models.manager import Manager -# from graphene.utils import LazyList - - -class LazyList(object): - pass - - try: import django_filters # noqa