Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport Django 4.1 compatibility fixes to v2 #1413

Merged
merged 8 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
12 changes: 3 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/forms/tests/test_converter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django import forms
from py.test import raises
from pytest import raises

from graphene import (
Boolean,
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/forms/tests/test_mutation.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/management/commands/graphql_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/rest_framework/tests/test_mutation.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions graphene_django/tests/issues/test_520.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/tests/test_forms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.core.exceptions import ValidationError
from py.test import raises
from pytest import raises

from ..forms import GlobalIDFormField, GlobalIDMultipleChoiceField

Expand Down
2 changes: 1 addition & 1 deletion graphene_django/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/tests/test_schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from py.test import raises
from pytest import raises

from ..registry import Registry
from ..types import DjangoObjectType
Expand Down
12 changes: 7 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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{38,39,310}-django{40,master},
py{37,38,39}-django22,
py{37,38,39}-django{30,31},
py{37,38,39,310}-django32,
py{38,39,310}-django{40,41,master},
black,flake8

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
Expand All @@ -21,13 +20,15 @@ DJANGO =
3.1: django31
3.2: django32
4.0: django40
4.1: django41
master: djangomaster

[testenv]
passenv = *
usedevelop = True
setenv =
DJANGO_SETTINGS_MODULE=examples.django_test_settings
PYTHONPATH=.
deps =
-e.[test]
psycopg2-binary
Expand All @@ -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}

Expand Down