From fdeadf5ce5a3c55b18b2c8d4fda56577dd99be99 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 2 Jan 2021 09:46:00 -0800 Subject: [PATCH] Fix project setup (#1087) * Fix project setup * Fix test_should_query_postgres_fields --- graphene_django/compat.py | 5 ++++- graphene_django/tests/test_query.py | 4 ++-- setup.cfg | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/graphene_django/compat.py b/graphene_django/compat.py index 8a2b933..537fd1d 100644 --- a/graphene_django/compat.py +++ b/graphene_django/compat.py @@ -6,13 +6,16 @@ try: # Postgres fields are only available in Django with psycopg2 installed # and we cannot have psycopg2 on PyPy from django.contrib.postgres.fields import ( + IntegerRangeField, ArrayField, HStoreField, JSONField as PGJSONField, RangeField, ) except ImportError: - ArrayField, HStoreField, PGJSONField, RangeField = (MissingType,) * 4 + IntegerRangeField, ArrayField, HStoreField, PGJSONField, RangeField = ( + MissingType, + ) * 5 try: # JSONField is only available from Django 3.1 diff --git a/graphene_django/tests/test_query.py b/graphene_django/tests/test_query.py index 2ff81a3..699814d 100644 --- a/graphene_django/tests/test_query.py +++ b/graphene_django/tests/test_query.py @@ -11,7 +11,7 @@ from py.test import raises import graphene from graphene.relay import Node -from ..compat import JSONField, MissingType +from ..compat import IntegerRangeField, MissingType from ..fields import DjangoConnectionField from ..types import DjangoObjectType from ..utils import DJANGO_FILTER_INSTALLED @@ -114,7 +114,7 @@ def test_should_query_well(): assert result.data == expected -@pytest.mark.skipif(JSONField is MissingType, reason="RangeField should exist") +@pytest.mark.skipif(IntegerRangeField is MissingType, reason="RangeField should exist") def test_should_query_postgres_fields(): from django.contrib.postgres.fields import ( IntegerRangeField, diff --git a/setup.cfg b/setup.cfg index d588786..52f6bf6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,5 +45,5 @@ use_parentheses=True line_length=88 [tool:pytest] -DJANGO_SETTINGS_MODULE = django_test_settings +DJANGO_SETTINGS_MODULE = examples.django_test_settings addopts = --random-order