mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-11-04 09:57:53 +03:00 
			
		
		
		
	Fix project setup (#1087)
* Fix project setup * Fix test_should_query_postgres_fields
This commit is contained in:
		
							parent
							
								
									8324d47999
								
							
						
					
					
						commit
						fdeadf5ce5
					
				| 
						 | 
					@ -6,13 +6,16 @@ try:
 | 
				
			||||||
    # Postgres fields are only available in Django with psycopg2 installed
 | 
					    # Postgres fields are only available in Django with psycopg2 installed
 | 
				
			||||||
    # and we cannot have psycopg2 on PyPy
 | 
					    # and we cannot have psycopg2 on PyPy
 | 
				
			||||||
    from django.contrib.postgres.fields import (
 | 
					    from django.contrib.postgres.fields import (
 | 
				
			||||||
 | 
					        IntegerRangeField,
 | 
				
			||||||
        ArrayField,
 | 
					        ArrayField,
 | 
				
			||||||
        HStoreField,
 | 
					        HStoreField,
 | 
				
			||||||
        JSONField as PGJSONField,
 | 
					        JSONField as PGJSONField,
 | 
				
			||||||
        RangeField,
 | 
					        RangeField,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
except ImportError:
 | 
					except ImportError:
 | 
				
			||||||
    ArrayField, HStoreField, PGJSONField, RangeField = (MissingType,) * 4
 | 
					    IntegerRangeField, ArrayField, HStoreField, PGJSONField, RangeField = (
 | 
				
			||||||
 | 
					        MissingType,
 | 
				
			||||||
 | 
					    ) * 5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
    # JSONField is only available from Django 3.1
 | 
					    # JSONField is only available from Django 3.1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@ from py.test import raises
 | 
				
			||||||
import graphene
 | 
					import graphene
 | 
				
			||||||
from graphene.relay import Node
 | 
					from graphene.relay import Node
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from ..compat import JSONField, MissingType
 | 
					from ..compat import IntegerRangeField, MissingType
 | 
				
			||||||
from ..fields import DjangoConnectionField
 | 
					from ..fields import DjangoConnectionField
 | 
				
			||||||
from ..types import DjangoObjectType
 | 
					from ..types import DjangoObjectType
 | 
				
			||||||
from ..utils import DJANGO_FILTER_INSTALLED
 | 
					from ..utils import DJANGO_FILTER_INSTALLED
 | 
				
			||||||
| 
						 | 
					@ -114,7 +114,7 @@ def test_should_query_well():
 | 
				
			||||||
    assert result.data == expected
 | 
					    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():
 | 
					def test_should_query_postgres_fields():
 | 
				
			||||||
    from django.contrib.postgres.fields import (
 | 
					    from django.contrib.postgres.fields import (
 | 
				
			||||||
        IntegerRangeField,
 | 
					        IntegerRangeField,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user