mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-14 13:47:12 +03:00
Backport Django 4.1 compatibility fixes to v2 (#1413)
* handle deprecation warning for requires_system_checks Removed in django 4.1. * Fix broken UT due to pytest import error (#1368) * import error resolved? * Fix tests * Remove Python 3.6 * django 4.1 requires python>=3.10 * Django 4.1 does support python 3.8 to 3.11 * Add Django 4.1 to tox --------- Co-authored-by: Yuekui <yuekui@users.noreply.github.com> Co-authored-by: Josh Warwick <josh.warwick15@gmail.com> Co-authored-by: Kien Dang <mail@kien.ai>
This commit is contained in:
parent
ede3880abb
commit
7c780a916a
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
|
@ -20,7 +20,7 @@ jobs:
|
||||||
pip install wheel
|
pip install wheel
|
||||||
python setup.py sdist bdist_wheel
|
python setup.py sdist bdist_wheel
|
||||||
- name: Publish a Python distribution to PyPI
|
- name: Publish a Python distribution to PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@v1.1.0
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
user: __token__
|
user: __token__
|
||||||
password: ${{ secrets.pypi_password }}
|
password: ${{ secrets.pypi_password }}
|
||||||
|
|
12
.github/workflows/tests.yml
vendored
12
.github/workflows/tests.yml
vendored
|
@ -8,29 +8,23 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
django: ["2.2", "3.0", "3.1", "3.2", "4.0"]
|
django: ["2.2", "3.0", "3.1", "3.2", "4.0", "4.1"]
|
||||||
python-version: ["3.8", "3.9"]
|
python-version: ["3.8", "3.9"]
|
||||||
include:
|
include:
|
||||||
- django: "2.2"
|
|
||||||
python-version: "3.6"
|
|
||||||
- django: "2.2"
|
- django: "2.2"
|
||||||
python-version: "3.7"
|
python-version: "3.7"
|
||||||
- django: "3.0"
|
|
||||||
python-version: "3.6"
|
|
||||||
- django: "3.0"
|
- django: "3.0"
|
||||||
python-version: "3.7"
|
python-version: "3.7"
|
||||||
- django: "3.1"
|
|
||||||
python-version: "3.6"
|
|
||||||
- django: "3.1"
|
- django: "3.1"
|
||||||
python-version: "3.7"
|
python-version: "3.7"
|
||||||
- django: "3.2"
|
|
||||||
python-version: "3.6"
|
|
||||||
- django: "3.2"
|
- django: "3.2"
|
||||||
python-version: "3.7"
|
python-version: "3.7"
|
||||||
- django: "3.2"
|
- django: "3.2"
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
- django: "4.0"
|
- django: "4.0"
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
- django: "4.1"
|
||||||
|
python-version: "3.10"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
|
|
@ -81,6 +81,7 @@ def test_array_field_exact_empty_list(Query):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist")
|
||||||
def test_array_field_filter_schema_type(Query):
|
def test_array_field_filter_schema_type(Query):
|
||||||
"""
|
"""
|
||||||
Check that the type in the filter is an array field like on the object type.
|
Check that the type in the filter is an array field like on the object type.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
|
|
||||||
from graphene import (
|
from graphene import (
|
||||||
Boolean,
|
Boolean,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
|
|
||||||
from graphene import Field, ObjectType, Schema, String
|
from graphene import Field, ObjectType, Schema, String
|
||||||
from graphene_django import DjangoObjectType
|
from graphene_django import DjangoObjectType
|
||||||
|
|
|
@ -48,7 +48,7 @@ class CommandArguments(BaseCommand):
|
||||||
class Command(CommandArguments):
|
class Command(CommandArguments):
|
||||||
help = "Dump Graphene schema as a JSON or GraphQL file"
|
help = "Dump Graphene schema as a JSON or GraphQL file"
|
||||||
can_import_settings = True
|
can_import_settings = True
|
||||||
requires_system_checks = False
|
requires_system_checks = []
|
||||||
|
|
||||||
def save_json_file(self, out, schema_dict, indent):
|
def save_json_file(self, out, schema_dict, indent):
|
||||||
with open(out, "w") as outfile:
|
with open(out, "w") as outfile:
|
||||||
|
|
|
@ -3,7 +3,7 @@ import copy
|
||||||
import graphene
|
import graphene
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from graphene import InputObjectType
|
from graphene import InputObjectType
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from ..serializer_converter import convert_serializer_field
|
from ..serializer_converter import convert_serializer_field
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from graphene import Field, ResolveInfo, NonNull, String
|
from graphene import Field, ResolveInfo, NonNull, String
|
||||||
|
|
|
@ -8,8 +8,8 @@ import graphene
|
||||||
|
|
||||||
from graphene import Field, ResolveInfo
|
from graphene import Field, ResolveInfo
|
||||||
from graphene.types.inputobjecttype import InputObjectType
|
from graphene.types.inputobjecttype import InputObjectType
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
from py.test import mark
|
from pytest import mark
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from ...types import DjangoObjectType
|
from ...types import DjangoObjectType
|
||||||
|
|
|
@ -46,7 +46,7 @@ def test_generate_graphql_file_on_call_graphql_schema():
|
||||||
open_mock.assert_called_once()
|
open_mock.assert_called_once()
|
||||||
|
|
||||||
handle = open_mock()
|
handle = open_mock()
|
||||||
assert handle.write.called_once()
|
handle.write.assert_called_once()
|
||||||
|
|
||||||
schema_output = handle.write.call_args[0][0]
|
schema_output = handle.write.call_args[0][0]
|
||||||
assert schema_output == dedent(
|
assert schema_output == dedent(
|
||||||
|
|
|
@ -3,7 +3,7 @@ from collections import namedtuple
|
||||||
import pytest
|
import pytest
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import NonNull
|
from graphene import NonNull
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
|
|
||||||
from ..forms import GlobalIDFormField, GlobalIDMultipleChoiceField
|
from ..forms import GlobalIDFormField, GlobalIDMultipleChoiceField
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.utils.functional import SimpleLazyObject
|
from django.utils.functional import SimpleLazyObject
|
||||||
from graphql_relay import to_global_id
|
from graphql_relay import to_global_id
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene.relay import Node
|
from graphene.relay import Node
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from py.test import raises
|
from pytest import raises
|
||||||
|
|
||||||
from ..registry import Registry
|
from ..registry import Registry
|
||||||
from ..types import DjangoObjectType
|
from ..types import DjangoObjectType
|
||||||
|
|
12
tox.ini
12
tox.ini
|
@ -1,14 +1,13 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist =
|
envlist =
|
||||||
py{36,37,38,39}-django22,
|
py{37,38,39}-django22,
|
||||||
py{36,37,38,39}-django{30,31},
|
py{37,38,39}-django{30,31},
|
||||||
py{36,37,38,39,310}-django32,
|
py{37,38,39,310}-django32,
|
||||||
py{38,39,310}-django{40,master},
|
py{38,39,310}-django{40,41,master},
|
||||||
black,flake8
|
black,flake8
|
||||||
|
|
||||||
[gh-actions]
|
[gh-actions]
|
||||||
python =
|
python =
|
||||||
3.6: py36
|
|
||||||
3.7: py37
|
3.7: py37
|
||||||
3.8: py38
|
3.8: py38
|
||||||
3.9: py39
|
3.9: py39
|
||||||
|
@ -21,6 +20,7 @@ DJANGO =
|
||||||
3.1: django31
|
3.1: django31
|
||||||
3.2: django32
|
3.2: django32
|
||||||
4.0: django40
|
4.0: django40
|
||||||
|
4.1: django41
|
||||||
master: djangomaster
|
master: djangomaster
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
@ -28,6 +28,7 @@ passenv = *
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
setenv =
|
setenv =
|
||||||
DJANGO_SETTINGS_MODULE=examples.django_test_settings
|
DJANGO_SETTINGS_MODULE=examples.django_test_settings
|
||||||
|
PYTHONPATH=.
|
||||||
deps =
|
deps =
|
||||||
-e.[test]
|
-e.[test]
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
|
@ -36,6 +37,7 @@ deps =
|
||||||
django31: Django>=3.1,<3.2
|
django31: Django>=3.1,<3.2
|
||||||
django32: Django>=3.2,<4.0
|
django32: Django>=3.2,<4.0
|
||||||
django40: Django>=4.0,<4.1
|
django40: Django>=4.0,<4.1
|
||||||
|
django41: Django>=4.1.3,<4.2
|
||||||
djangomaster: https://github.com/django/django/archive/master.zip
|
djangomaster: https://github.com/django/django/archive/master.zip
|
||||||
commands = {posargs:py.test --cov=graphene_django graphene_django examples}
|
commands = {posargs:py.test --cov=graphene_django graphene_django examples}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user