8000 Fix project setup by lucas-bremond · Pull Request #1087 · graphql-python/graphene-django · GitHub
[go: up one dir, main page]

Skip to content

Fix project setup #1087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
8000 Jump to file
Failed to load files.
Loading
Diff view
Diff view
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