Skip to content

Commit

Permalink
Fix project setup (#1087)
Browse files Browse the repository at this point in the history
* Fix project setup

* Fix test_should_query_postgres_fields
  • Loading branch information
lucas-bremond authored Jan 2, 2021
1 parent 8324d47 commit fdeadf5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion graphene_django/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ class MissingType(object):
# 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
Expand Down
4 changes: 2 additions & 2 deletions graphene_django/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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
Expand Down Expand Up @@ -114,7 +114,7 @@ def resolve_reporter(self, info):
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,
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fdeadf5

Please sign in to comment.