From 9b193ba1ac6a8ff0e48df0f8614ce0618bcc9963 Mon Sep 17 00:00:00 2001 From: Santiago Aguiar Date: Thu, 25 May 2023 16:49:40 -0300 Subject: [PATCH 1/8] handle deprecation warning for requires_system_checks Removed in django 4.1. --- graphene_django/management/commands/graphql_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphene_django/management/commands/graphql_schema.py b/graphene_django/management/commands/graphql_schema.py index bd1c8e600..0064237e3 100644 --- a/graphene_django/management/commands/graphql_schema.py +++ b/graphene_django/management/commands/graphql_schema.py @@ -48,7 +48,7 @@ def add_arguments(self, parser): class Command(CommandArguments): help = "Dump Graphene schema as a JSON or GraphQL file" can_import_settings = True - requires_system_checks = False + requires_system_checks = [] def save_json_file(self, out, schema_dict, indent): with open(out, "w") as outfile: From da9cd77f67b5507ae461d14f3e1ca4e93bca4dae Mon Sep 17 00:00:00 2001 From: Yuekui Date: Mon, 14 Nov 2022 02:56:18 -0800 Subject: [PATCH 2/8] Fix broken UT due to pytest import error (#1368) --- graphene_django/forms/tests/test_converter.py | 2 +- graphene_django/forms/tests/test_mutation.py | 2 +- graphene_django/rest_framework/tests/test_field_converter.py | 2 +- graphene_django/rest_framework/tests/test_mutation.py | 2 +- graphene_django/tests/issues/test_520.py | 4 ++-- graphene_django/tests/test_converter.py | 2 +- graphene_django/tests/test_forms.py | 2 +- graphene_django/tests/test_query.py | 2 +- graphene_django/tests/test_schema.py | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/graphene_django/forms/tests/test_converter.py b/graphene_django/forms/tests/test_converter.py index 78b315c43..f19ee0fa9 100644 --- a/graphene_django/forms/tests/test_converter.py +++ b/graphene_django/forms/tests/test_converter.py @@ -1,5 +1,5 @@ from django import forms -from py.test import raises +from pytest import raises from graphene import ( Boolean, diff --git a/graphene_django/forms/tests/test_mutation.py b/graphene_django/forms/tests/test_mutation.py index ed92863ea..d840d29b8 100644 --- a/graphene_django/forms/tests/test_mutation.py +++ b/graphene_django/forms/tests/test_mutation.py @@ -1,7 +1,7 @@ import pytest from django import forms from django.core.exceptions import ValidationError -from py.test import raises +from pytest import raises from graphene import Field, ObjectType, Schema, String from graphene_django import DjangoObjectType diff --git a/graphene_django/rest_framework/tests/test_field_converter.py b/graphene_django/rest_framework/tests/test_field_converter.py index 485836579..8da8377c0 100644 --- a/graphene_django/rest_framework/tests/test_field_converter.py +++ b/graphene_django/rest_framework/tests/test_field_converter.py @@ -3,7 +3,7 @@ import graphene from django.db import models from graphene import InputObjectType -from py.test import raises +from pytest import raises from rest_framework import serializers from ..serializer_converter import convert_serializer_field diff --git a/graphene_django/rest_framework/tests/test_mutation.py b/graphene_django/rest_framework/tests/test_mutation.py index 5c2518d9e..f2b8e44c8 100644 --- a/graphene_django/rest_framework/tests/test_mutation.py +++ b/graphene_django/rest_framework/tests/test_mutation.py @@ -1,6 +1,6 @@ import datetime -from py.test import raises +from pytest import raises from rest_framework import serializers from graphene import Field, ResolveInfo, NonNull, String diff --git a/graphene_django/tests/issues/test_520.py b/graphene_django/tests/issues/test_520.py index 60c5b543c..4e55f9655 100644 --- a/graphene_django/tests/issues/test_520.py +++ b/graphene_django/tests/issues/test_520.py @@ -8,8 +8,8 @@ from graphene import Field, ResolveInfo from graphene.types.inputobjecttype import InputObjectType -from py.test import raises -from py.test import mark +from pytest import raises +from pytest import mark from rest_framework import serializers from ...types import DjangoObjectType diff --git a/graphene_django/tests/test_converter.py b/graphene_django/tests/test_converter.py index 7b38a45fd..cac904ba0 100644 --- a/graphene_django/tests/test_converter.py +++ b/graphene_django/tests/test_converter.py @@ -3,7 +3,7 @@ import pytest from django.db import models from django.utils.translation import gettext_lazy as _ -from py.test import raises +from pytest import raises import graphene from graphene import NonNull diff --git a/graphene_django/tests/test_forms.py b/graphene_django/tests/test_forms.py index fa6628d26..a42fcee9e 100644 --- a/graphene_django/tests/test_forms.py +++ b/graphene_django/tests/test_forms.py @@ -1,5 +1,5 @@ from django.core.exceptions import ValidationError -from py.test import raises +from pytest import raises from ..forms import GlobalIDFormField, GlobalIDMultipleChoiceField diff --git a/graphene_django/tests/test_query.py b/graphene_django/tests/test_query.py index fd43fb0c9..77a9f4ae9 100644 --- a/graphene_django/tests/test_query.py +++ b/graphene_django/tests/test_query.py @@ -6,7 +6,7 @@ from django.db.models import Q from django.utils.functional import SimpleLazyObject from graphql_relay import to_global_id -from py.test import raises +from pytest import raises import graphene from graphene.relay import Node diff --git a/graphene_django/tests/test_schema.py b/graphene_django/tests/test_schema.py index 2c2f74b67..52d749911 100644 --- a/graphene_django/tests/test_schema.py +++ b/graphene_django/tests/test_schema.py @@ -1,4 +1,4 @@ -from py.test import raises +from pytest import raises from ..registry import Registry from ..types import DjangoObjectType From 01e4a61dd95ceff2ecd761bebefaca1866c1d853 Mon Sep 17 00:00:00 2001 From: Josh Warwick Date: Mon, 27 Feb 2023 15:38:17 +0000 Subject: [PATCH 3/8] import error resolved? --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 952ba6834..a9d10b5ef 100644 --- a/tox.ini +++ b/tox.ini @@ -28,6 +28,7 @@ passenv = * usedevelop = True setenv = DJANGO_SETTINGS_MODULE=examples.django_test_settings + PYTHONPATH=. deps = -e.[test] psycopg2-binary From 5804654f65eb03ffeac456bb15bcb53d0f41fe8a Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Fri, 26 May 2023 23:45:00 +0800 Subject: [PATCH 4/8] Fix tests --- graphene_django/filter/tests/test_array_field_exact_filter.py | 1 + graphene_django/tests/test_command.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/graphene_django/filter/tests/test_array_field_exact_filter.py b/graphene_django/filter/tests/test_array_field_exact_filter.py index 814fd3388..f211466a1 100644 --- a/graphene_django/filter/tests/test_array_field_exact_filter.py +++ b/graphene_django/filter/tests/test_array_field_exact_filter.py @@ -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): """ Check that the type in the filter is an array field like on the object type. diff --git a/graphene_django/tests/test_command.py b/graphene_django/tests/test_command.py index 297e46183..cbbcf2f9a 100644 --- a/graphene_django/tests/test_command.py +++ b/graphene_django/tests/test_command.py @@ -46,7 +46,7 @@ class Query(ObjectType): open_mock.assert_called_once() handle = open_mock() - assert handle.write.called_once() + handle.write.assert_called_once() schema_output = handle.write.call_args[0][0] assert schema_output == dedent( From 21def9ee826bbbeb738924db8a59043c22d565cb Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Fri, 26 May 2023 23:53:33 +0800 Subject: [PATCH 5/8] Remove Python 3.6 --- .github/workflows/deploy.yml | 2 +- .github/workflows/tests.yml | 12 +++--------- tox.ini | 7 +++---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6cce61d5c..b91be110b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,7 +20,7 @@ jobs: pip install wheel python setup.py sdist bdist_wheel - 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: user: __token__ password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 045d73fa8..7803de29e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,29 +8,23 @@ jobs: strategy: max-parallel: 4 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"] include: - - django: "2.2" - python-version: "3.6" - django: "2.2" python-version: "3.7" - - django: "3.0" - python-version: "3.6" - django: "3.0" python-version: "3.7" - - django: "3.1" - python-version: "3.6" - django: "3.1" python-version: "3.7" - - django: "3.2" - python-version: "3.6" - django: "3.2" python-version: "3.7" - django: "3.2" python-version: "3.10" - django: "4.0" python-version: "3.10" + - django: "4.1" + python-version: "3.10" steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/tox.ini b/tox.ini index a9d10b5ef..1d4678834 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,13 @@ [tox] envlist = - py{36,37,38,39}-django22, - py{36,37,38,39}-django{30,31}, - py{36,37,38,39,310}-django32, + py{37,38,39}-django22, + py{37,38,39}-django{30,31}, + py{37,38,39,310}-django32, py{38,39,310}-django{40,master}, black,flake8 [gh-actions] python = - 3.6: py36 3.7: py37 3.8: py38 3.9: py39 From cf88b5ff1bb17c1862be6bcde2ea21f0f4676ce0 Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Sat, 27 May 2023 00:02:13 +0800 Subject: [PATCH 6/8] django 4.1 requires python>=3.10 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7803de29e..4163b7c80 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 matrix: - django: ["2.2", "3.0", "3.1", "3.2", "4.0", "4.1"] + django: ["2.2", "3.0", "3.1", "3.2", "4.0"] python-version: ["3.8", "3.9"] include: - django: "2.2" From da4b813ed430c26f771c4aa4a27c84e4dbcaeb14 Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Sat, 27 May 2023 00:19:55 +0800 Subject: [PATCH 7/8] Django 4.1 does support python 3.8 to 3.11 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4163b7c80..7803de29e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 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"] include: - django: "2.2" From dc301b261166e0e5e1e370f929e2491fb1c68b5a Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Sat, 27 May 2023 00:32:07 +0800 Subject: [PATCH 8/8] Add Django 4.1 to tox --- tox.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 1d4678834..d9961cf25 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist = py{37,38,39}-django22, py{37,38,39}-django{30,31}, py{37,38,39,310}-django32, - py{38,39,310}-django{40,master}, + py{38,39,310}-django{40,41,master}, black,flake8 [gh-actions] @@ -20,6 +20,7 @@ DJANGO = 3.1: django31 3.2: django32 4.0: django40 + 4.1: django41 master: djangomaster [testenv] @@ -36,6 +37,7 @@ deps = django31: Django>=3.1,<3.2 django32: Django>=3.2,<4.0 django40: Django>=4.0,<4.1 + django41: Django>=4.1.3,<4.2 djangomaster: https://github.com/django/django/archive/master.zip commands = {posargs:py.test --cov=graphene_django graphene_django examples}