python3Packages.graphene-django: 2022-03-03 -> 3.0.0
This commit is contained in:
parent
089c15835e
commit
a08e69ffeb
@ -2,7 +2,6 @@
|
||||
, buildPythonPackage
|
||||
, pythonOlder
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
|
||||
, graphene
|
||||
, graphql-core
|
||||
@ -13,6 +12,7 @@
|
||||
|
||||
, django-filter
|
||||
, mock
|
||||
, py
|
||||
, pytest-django
|
||||
, pytest-random-order
|
||||
, pytestCheckHook
|
||||
@ -20,26 +20,17 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "graphene-django";
|
||||
version = "unstable-2022-03-03";
|
||||
version = "3.0.0";
|
||||
format = "setuptools";
|
||||
disabled = pythonOlder "3.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "graphql-python";
|
||||
repo = pname;
|
||||
rev = "f6ec0689c18929344c79ae363d2e3d5628fa4a2d";
|
||||
hash = "sha256-KTZ5jcoeHYXnlaF47t8jIi6+7NyMyA4hDPv+il3bt+U=";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-wSZm0hRukBmvrmU3bsqFuZSQRXBwwye9J4ojuSz1uzE=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./graphene-3_2_0.patch
|
||||
(fetchpatch {
|
||||
url = "https://github.com/graphql-python/graphene-django/commit/ca555293a4334c26cf9a390dd1e3d0bd4c819a17.patch";
|
||||
excludes = [ "setup.py" ];
|
||||
sha256 = "sha256-RxG1MRhmpBKnHhSg4SV+DjZ3uA0nl9oUeei56xjtUpw=";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace setup.py \
|
||||
--replace '"pytest-runner"' ""
|
||||
@ -61,6 +52,7 @@ buildPythonPackage rec {
|
||||
checkInputs = [
|
||||
django-filter
|
||||
mock
|
||||
py
|
||||
pytest-django
|
||||
pytest-random-order
|
||||
pytestCheckHook
|
||||
|
@ -1,150 +0,0 @@
|
||||
diff --git a/graphene_django/filter/tests/test_fields.py b/graphene_django/filter/tests/test_fields.py
|
||||
index 7d440f4..0aec6e4 100644
|
||||
--- a/graphene_django/filter/tests/test_fields.py
|
||||
+++ b/graphene_django/filter/tests/test_fields.py
|
||||
@@ -1005,7 +1005,7 @@ def test_integer_field_filter_type():
|
||||
|
||||
schema = Schema(query=Query)
|
||||
|
||||
- assert str(schema) == dedent(
|
||||
+ assert str(schema).rstrip() + "\n" == dedent(
|
||||
"""\
|
||||
type Query {
|
||||
pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null): PetTypeConnection
|
||||
@@ -1074,7 +1074,7 @@ def test_other_filter_types():
|
||||
|
||||
schema = Schema(query=Query)
|
||||
|
||||
- assert str(schema) == dedent(
|
||||
+ assert str(schema).rstrip() + "\n" == dedent(
|
||||
"""\
|
||||
type Query {
|
||||
pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null, age_Isnull: Boolean = null, age_Lt: Int = null): PetTypeConnection
|
||||
diff --git a/graphene_django/tests/test_command.py b/graphene_django/tests/test_command.py
|
||||
index 70116b8..a4ab4db 100644
|
||||
--- a/graphene_django/tests/test_command.py
|
||||
+++ b/graphene_django/tests/test_command.py
|
||||
@@ -49,7 +49,7 @@ def test_generate_graphql_file_on_call_graphql_schema():
|
||||
assert handle.write.called_once()
|
||||
|
||||
schema_output = handle.write.call_args[0][0]
|
||||
- assert schema_output == dedent(
|
||||
+ assert schema_output.rstrip() + "\n" == dedent(
|
||||
"""\
|
||||
type Query {
|
||||
hi: String
|
||||
diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py
|
||||
index bde72c7..0b64440 100644
|
||||
--- a/graphene_django/tests/test_types.py
|
||||
+++ b/graphene_django/tests/test_types.py
|
||||
@@ -247,7 +247,7 @@ def test_schema_representation():
|
||||
}
|
||||
"""
|
||||
)
|
||||
- assert str(schema) == expected
|
||||
+ assert str(schema).rstrip() + "\n" == expected
|
||||
|
||||
|
||||
def with_local_registry(func):
|
||||
@@ -515,7 +515,7 @@ class TestDjangoObjectType:
|
||||
|
||||
schema = Schema(query=Query)
|
||||
|
||||
- assert str(schema) == dedent(
|
||||
+ assert str(schema).rstrip() + "\n" == dedent(
|
||||
"""\
|
||||
type Query {
|
||||
pet: Pet
|
||||
@@ -541,7 +541,7 @@ class TestDjangoObjectType:
|
||||
|
||||
schema = Schema(query=Query)
|
||||
|
||||
- assert str(schema) == dedent(
|
||||
+ assert str(schema).rstrip() + "\n" == dedent(
|
||||
"""\
|
||||
type Query {
|
||||
pet: Pet
|
||||
@@ -576,7 +576,7 @@ class TestDjangoObjectType:
|
||||
|
||||
schema = Schema(query=Query)
|
||||
|
||||
- assert str(schema) == dedent(
|
||||
+ assert str(schema).rstrip() + "\n" == dedent(
|
||||
"""\
|
||||
type Query {
|
||||
pet: Pet
|
||||
@@ -603,7 +603,7 @@ class TestDjangoObjectType:
|
||||
|
||||
schema = Schema(query=Query)
|
||||
|
||||
- assert str(schema) == dedent(
|
||||
+ assert str(schema).rstrip() + "\n" == dedent(
|
||||
"""\
|
||||
type Query {
|
||||
pet: PetModelKind
|
||||
@@ -642,7 +642,7 @@ class TestDjangoObjectType:
|
||||
|
||||
schema = Schema(query=Query)
|
||||
|
||||
- assert str(schema) == dedent(
|
||||
+ assert str(schema).rstrip() + "\n" == dedent(
|
||||
"""\
|
||||
type Query {
|
||||
pet: PetModelKind
|
||||
diff --git a/graphene_django/tests/test_views.py b/graphene_django/tests/test_views.py
|
||||
index 945fa87..e2e8b46 100644
|
||||
--- a/graphene_django/tests/test_views.py
|
||||
+++ b/graphene_django/tests/test_views.py
|
||||
@@ -109,12 +109,10 @@ def test_reports_validation_errors(client):
|
||||
{
|
||||
"message": "Cannot query field 'unknownOne' on type 'QueryRoot'.",
|
||||
"locations": [{"line": 1, "column": 9}],
|
||||
- "path": None,
|
||||
},
|
||||
{
|
||||
"message": "Cannot query field 'unknownTwo' on type 'QueryRoot'.",
|
||||
"locations": [{"line": 1, "column": 21}],
|
||||
- "path": None,
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -135,8 +133,6 @@ def test_errors_when_missing_operation_name(client):
|
||||
"errors": [
|
||||
{
|
||||
"message": "Must provide operation name if query contains multiple operations.",
|
||||
- "locations": None,
|
||||
- "path": None,
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -476,8 +472,7 @@ def test_handles_syntax_errors_caught_by_graphql(client):
|
||||
"errors": [
|
||||
{
|
||||
"locations": [{"column": 1, "line": 1}],
|
||||
- "message": "Syntax Error: Unexpected Name 'syntaxerror'.",
|
||||
- "path": None,
|
||||
+ "message": "Syntax Error: Unexpected Name 'syntaxerror'."
|
||||
}
|
||||
]
|
||||
}
|
||||
diff --git a/graphene_django/views.py b/graphene_django/views.py
|
||||
index c23b020..f533f70 100644
|
||||
--- a/graphene_django/views.py
|
||||
+++ b/graphene_django/views.py
|
||||
@@ -11,7 +11,6 @@ from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.generic import View
|
||||
from graphql import OperationType, get_operation_ast, parse, validate
|
||||
from graphql.error import GraphQLError
|
||||
-from graphql.error import format_error as format_graphql_error
|
||||
from graphql.execution import ExecutionResult
|
||||
|
||||
from graphene import Schema
|
||||
@@ -387,7 +386,7 @@ class GraphQLView(View):
|
||||
@staticmethod
|
||||
def format_error(error):
|
||||
if isinstance(error, GraphQLError):
|
||||
- return format_graphql_error(error)
|
||||
+ return error.formatted
|
||||
|
||||
return {"message": str(error)}
|
||||
|
Loading…
Reference in New Issue
Block a user