Skip to content

Commit 7c780a9

Browse files
santiagoaguiaryuekuijaw9ckiendang
authored
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 <[email protected]> Co-authored-by: Josh Warwick <[email protected]> Co-authored-by: Kien Dang <[email protected]>
1 parent ede3880 commit 7c780a9

File tree

15 files changed

+24
-27
lines changed

15 files changed

+24
-27
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
pip install wheel
2121
python setup.py sdist bdist_wheel
2222
- name: Publish a Python distribution to PyPI
23-
uses: pypa/gh-action-pypi-publish@v1.1.0
23+
uses: pypa/gh-action-pypi-publish@release/v1
2424
with:
2525
user: __token__
2626
password: ${{ secrets.pypi_password }}

.github/workflows/tests.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,23 @@ jobs:
88
strategy:
99
max-parallel: 4
1010
matrix:
11-
django: ["2.2", "3.0", "3.1", "3.2", "4.0"]
11+
django: ["2.2", "3.0", "3.1", "3.2", "4.0", "4.1"]
1212
python-version: ["3.8", "3.9"]
1313
include:
14-
- django: "2.2"
15-
python-version: "3.6"
1614
- django: "2.2"
1715
python-version: "3.7"
18-
- django: "3.0"
19-
python-version: "3.6"
2016
- django: "3.0"
2117
python-version: "3.7"
22-
- django: "3.1"
23-
python-version: "3.6"
2418
- django: "3.1"
2519
python-version: "3.7"
26-
- django: "3.2"
27-
python-version: "3.6"
2820
- django: "3.2"
2921
python-version: "3.7"
3022
- django: "3.2"
3123
python-version: "3.10"
3224
- django: "4.0"
3325
python-version: "3.10"
26+
- django: "4.1"
27+
python-version: "3.10"
3428
steps:
3529
- uses: actions/checkout@v3
3630
- name: Set up Python ${{ matrix.python-version }}

graphene_django/filter/tests/test_array_field_exact_filter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def test_array_field_exact_empty_list(Query):
8181
]
8282

8383

84+
@pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist")
8485
def test_array_field_filter_schema_type(Query):
8586
"""
8687
Check that the type in the filter is an array field like on the object type.

graphene_django/forms/tests/test_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django import forms
2-
from py.test import raises
2+
from pytest import raises
33

44
from graphene import (
55
Boolean,

graphene_django/forms/tests/test_mutation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22
from django import forms
33
from django.core.exceptions import ValidationError
4-
from py.test import raises
4+
from pytest import raises
55

66
from graphene import Field, ObjectType, Schema, String
77
from graphene_django import DjangoObjectType

graphene_django/management/commands/graphql_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def add_arguments(self, parser):
4848
class Command(CommandArguments):
4949
help = "Dump Graphene schema as a JSON or GraphQL file"
5050
can_import_settings = True
51-
requires_system_checks = False
51+
requires_system_checks = []
5252

5353
def save_json_file(self, out, schema_dict, indent):
5454
with open(out, "w") as outfile:

graphene_django/rest_framework/tests/test_field_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import graphene
44
from django.db import models
55
from graphene import InputObjectType
6-
from py.test import raises
6+
from pytest import raises
77
from rest_framework import serializers
88

99
from ..serializer_converter import convert_serializer_field

graphene_django/rest_framework/tests/test_mutation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datetime
22

3-
from py.test import raises
3+
from pytest import raises
44
from rest_framework import serializers
55

66
from graphene import Field, ResolveInfo, NonNull, String

graphene_django/tests/issues/test_520.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
from graphene import Field, ResolveInfo
1010
from graphene.types.inputobjecttype import InputObjectType
11-
from py.test import raises
12-
from py.test import mark
11+
from pytest import raises
12+
from pytest import mark
1313
from rest_framework import serializers
1414

1515
from ...types import DjangoObjectType

graphene_django/tests/test_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Query(ObjectType):
4646
open_mock.assert_called_once()
4747

4848
handle = open_mock()
49-
assert handle.write.called_once()
49+
handle.write.assert_called_once()
5050

5151
schema_output = handle.write.call_args[0][0]
5252
assert schema_output == dedent(

0 commit comments

Comments
 (0)