From 86c5309c4537b8f898a4cf8f2b516efa14be18f8 Mon Sep 17 00:00:00 2001 From: Yuekui Date: Mon, 14 Nov 2022 02:56:18 -0800 Subject: [PATCH 1/3] 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 05584a5..b61227b 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 import graphene from graphene import ( diff --git a/graphene_django/forms/tests/test_mutation.py b/graphene_django/forms/tests/test_mutation.py index 0770acb..14c407c 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 4858365..8da8377 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 copy 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 e0e5602..5de8237 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 diff --git a/graphene_django/tests/issues/test_520.py b/graphene_django/tests/issues/test_520.py index 60c5b54..4e55f96 100644 --- a/graphene_django/tests/issues/test_520.py +++ b/graphene_django/tests/issues/test_520.py @@ -8,8 +8,8 @@ import graphene 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 9158b12..4996505 100644 --- a/graphene_django/tests/test_converter.py +++ b/graphene_django/tests/test_converter.py @@ -3,7 +3,7 @@ from collections import namedtuple 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 fa6628d..a42fcee 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 504bb0e..df339d8 100644 --- a/graphene_django/tests/test_query.py +++ b/graphene_django/tests/test_query.py @@ -6,7 +6,7 @@ from django.db import models 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 1c889f1..ff2d8a6 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 a000d58514b1fd28b701cf3d159f8e5cafb28cae Mon Sep 17 00:00:00 2001 From: Omar Mirza Date: Fri, 7 Oct 2022 18:11:27 -0400 Subject: [PATCH 2/3] Clarify cookbook example READMEs Currently the relay cookbook's readme has a link to the plain tutorial page. The plain cookbook readme also instructs the user to change directory into the directory for the relay example. This change fixes both issues. Also changed the title for the relay example to specify that it uses relay. --- examples/cookbook-plain/README.md | 2 +- examples/cookbook/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/cookbook-plain/README.md b/examples/cookbook-plain/README.md index 0ec906b..dcd2420 100644 --- a/examples/cookbook-plain/README.md +++ b/examples/cookbook-plain/README.md @@ -14,7 +14,7 @@ whole Graphene repository: ```bash # Get the example project code git clone https://github.com/graphql-python/graphene-django.git -cd graphene-django/examples/cookbook +cd graphene-django/examples/cookbook-plain ``` It is good idea (but not required) to create a virtual environment diff --git a/examples/cookbook/README.md b/examples/cookbook/README.md index 0ec906b..098b119 100644 --- a/examples/cookbook/README.md +++ b/examples/cookbook/README.md @@ -1,4 +1,4 @@ -Cookbook Example Django Project +Cookbook Example (Relay) Django Project =============================== This example project demos integration between Graphene and Django. @@ -60,5 +60,5 @@ Now you should be ready to start the server: Now head on over to [http://127.0.0.1:8000/graphql](http://127.0.0.1:8000/graphql) and run some queries! -(See the [Graphene-Django Tutorial](http://docs.graphene-python.org/projects/django/en/latest/tutorial-plain/#testing-our-graphql-schema) +(See the [Graphene-Django Tutorial](http://docs.graphene-python.org/projects/django/en/latest/tutorial-relay/#testing-our-graphql-schema) for some example queries) From daa0ab046bf0b22b36b45b2fde0471997cdd7044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Clgen=20Sar=C4=B1kavak?= Date: Wed, 23 Nov 2022 01:16:14 +0300 Subject: [PATCH 3/3] Update pre-commit tools (#1364) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 829cb81..e64c4e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,12 +16,12 @@ repos: - id: trailing-whitespace exclude: README.md - repo: https://github.com/asottile/pyupgrade - rev: v2.37.3 + rev: v3.2.0 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/psf/black - rev: 22.6.0 + rev: 22.10.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8