python3Packages.graphene-django: unstable-2021-06-11 -> unstable-2022-03-03

main
Ember 'n0emis' Keske 2 years ago
parent 7b6f2b6c8a
commit 021fad3832
No known key found for this signature in database
GPG Key ID: 00FAF748B777CF10
  1. 10
      pkgs/development/python-modules/graphene-django/default.nix
  2. 150
      pkgs/development/python-modules/graphene-django/graphene-3_2_0.patch

@ -19,17 +19,21 @@
buildPythonPackage rec {
pname = "graphene-django";
version = "unstable-2021-06-11";
version = "unstable-2022-03-03";
format = "setuptools";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "graphql-python";
repo = pname;
rev = "e7f7d8da07ba1020f9916153f17e97b0ec037712";
sha256 = "0b33q1im90ahp3gzy9wx5amfzy6q57ydjpy5rn988gh81hbyqaxv";
rev = "f6ec0689c18929344c79ae363d2e3d5628fa4a2d";
hash = "sha256-KTZ5jcoeHYXnlaF47t8jIi6+7NyMyA4hDPv+il3bt+U=";
};
patches = [
./graphene-3_2_0.patch
];
postPatch = ''
substituteInPlace setup.py \
--replace '"pytest-runner"' ""

@ -0,0 +1,150 @@
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…
Cancel
Save