Merge branch 'master' into support-3.12

This commit is contained in:
Erik Wrede 2024-06-13 16:43:35 +02:00 committed by GitHub
commit a9c9572062
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 48 additions and 1248 deletions

View File

@ -10,9 +10,15 @@ jobs:
runs-on: ubuntu-latest
steps:
<<<<<<< support-3.12
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
=======
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
>>>>>>> master
with:
python-version: "3.11"
- name: Build wheel and source tarball

View File

@ -7,9 +7,15 @@ jobs:
runs-on: ubuntu-latest
steps:
<<<<<<< support-3.12
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
=======
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
>>>>>>> master
with:
python-version: "3.11"
- name: Install dependencies

View File

@ -25,14 +25,18 @@ jobs:
fail-fast: false
matrix:
include:
<<<<<<< support-3.12
- {name: '3.12.0-rc.1', python: '3.12.0-rc.1', os: ubuntu-latest, tox: py312}
=======
- {name: '3.12', python: '3.12', os: ubuntu-latest, tox: py312}
>>>>>>> master
- {name: '3.11', python: '3.11', os: ubuntu-latest, tox: py311}
- {name: '3.10', python: '3.10', os: ubuntu-latest, tox: py310}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
@ -43,14 +47,12 @@ jobs:
- name: get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: cache pip dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}
- run: pip install tox
- run: tox -e ${{ matrix.tox }}
- name: Upload coverage.xml

View File

@ -1,2 +1,2 @@
[settings]
known_third_party = aniso8601,graphql,graphql_relay,promise,pytest,pyutils,setuptools,snapshottest,sphinx_graphene_theme
known_third_party = graphql,graphql_relay,promise,pytest,pyutils,setuptools,snapshottest,sphinx_graphene_theme

View File

@ -141,7 +141,11 @@ file:
.. code:: sh
<<<<<<< support-3.12
tox -e py311
=======
tox -e py10
>>>>>>> master
Tox can only use whatever versions of Python are installed on your
system. When you create a pull request, Travis will also be running the

View File

@ -59,7 +59,8 @@ When we send a **Query** requesting only one **Field**, ``hello``, and specify a
Requirements
~~~~~~~~~~~~
- Python (3.8, 3.9, 3.10, 3.11, pypy)
- Python (3.8, 3.9, 3.10, 3.11, 3.12, pypy)
- Graphene (3.0)
Project setup

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ from ...types import Int, ObjectType, Schema, String
class TestUUIDGlobalID:
def setup(self):
def setup_method(self):
self.user_list = [
{"id": uuid4(), "name": "First"},
{"id": uuid4(), "name": "Second"},
@ -77,7 +77,7 @@ class TestUUIDGlobalID:
class TestSimpleGlobalID:
def setup(self):
def setup_method(self):
self.user_list = [
{"id": "my global primary key in clear 1", "name": "First"},
{"id": "my global primary key in clear 2", "name": "Second"},
@ -140,7 +140,7 @@ class TestSimpleGlobalID:
class TestCustomGlobalID:
def setup(self):
def setup_method(self):
self.user_list = [
{"id": 1, "name": "First"},
{"id": 2, "name": "Second"},
@ -219,7 +219,7 @@ class TestCustomGlobalID:
class TestIncompleteCustomGlobalID:
def setup(self):
def setup_method(self):
self.user_list = [
{"id": 1, "name": "First"},
{"id": 2, "name": "Second"},

View File

@ -2,7 +2,6 @@ from __future__ import absolute_import
import datetime
from aniso8601 import parse_date, parse_datetime, parse_time
from graphql.error import GraphQLError
from graphql.language import StringValueNode, print_ast
@ -39,7 +38,7 @@ class Date(Scalar):
if not isinstance(value, str):
raise GraphQLError(f"Date cannot represent non-string value: {repr(value)}")
try:
return parse_date(value)
return datetime.date.fromisoformat(value)
except ValueError:
raise GraphQLError(f"Date cannot represent value: {repr(value)}")
@ -74,7 +73,7 @@ class DateTime(Scalar):
f"DateTime cannot represent non-string value: {repr(value)}"
)
try:
return parse_datetime(value)
return datetime.datetime.fromisoformat(value)
except ValueError:
raise GraphQLError(f"DateTime cannot represent value: {repr(value)}")
@ -107,6 +106,6 @@ class Time(Scalar):
if not isinstance(value, str):
raise GraphQLError(f"Time cannot represent non-string value: {repr(value)}")
try:
return parse_time(value)
return datetime.time.fromisoformat(value)
except ValueError:
raise GraphQLError(f"Time cannot represent value: {repr(value)}")

View File

@ -43,7 +43,8 @@ class Field(MountedType):
args:
type (class for a graphene.UnmountedType): Must be a class (not an instance) of an
unmounted graphene type (ex. scalar or object) which is used for the type of this
field in the GraphQL schema.
field in the GraphQL schema. You can provide a dotted module import path (string)
to the class instead of the class itself (e.g. to avoid circular import issues).
args (optional, Dict[str, graphene.Argument]): Arguments that can be input to the field.
Prefer to use ``**extra_args``, unless you use an argument name that clashes with one
of the Field arguments presented here (see :ref:`example<ResolverParamGraphQLArguments>`).

View File

@ -5,10 +5,8 @@ from .field import Field
from .interface import Interface
from .utils import yank_fields_from_attrs
try:
from dataclasses import make_dataclass, field
except ImportError:
from ..pyutils.dataclasses import make_dataclass, field # type: ignore
# For static type checking with type checker
if TYPE_CHECKING:
from typing import Dict, Iterable, Type # NOQA

View File

@ -45,15 +45,13 @@ class PyTest(TestCommand):
tests_require = [
"pytest>=6,<7",
"pytest-benchmark>=3.4,<4",
"pytest-cov>=3,<4",
"pytest>=7,<8",
"pytest-benchmark>=4,<5",
"pytest-cov>=4,<5",
"pytest-mock>=3,<4",
"pytest-asyncio>=0.16,<2",
"snapshottest>=0.6,<1",
"coveralls>=3.3,<4",
"mock>=4,<5",
"iso8601>=1,<2",
]
dev_requires = ["black==22.3.0", "flake8>=4,<5"] + tests_require
@ -77,13 +75,16 @@ setup(
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
<<<<<<< support-3.12
=======
"Programming Language :: Python :: 3.12",
>>>>>>> master
],
keywords="api graphql protocol rest relay graphene",
packages=find_packages(exclude=["examples*"]),
install_requires=[
"graphql-core>=3.1,<3.3",
"graphql-relay>=3.1,<3.3",
"aniso8601>=8,<10",
],
tests_require=tests_require,
extras_require={"test": tests_require, "dev": dev_requires},

View File

@ -8,7 +8,11 @@ deps =
setenv =
PYTHONPATH = .:{envdir}
commands =
<<<<<<< support-3.12
py{38,39,310,311,312}: pytest --cov=graphene graphene --cov-report=term --cov-report=xml examples {posargs}
=======
py{38,39,310,311,12}: pytest --cov=graphene graphene --cov-report=term --cov-report=xml examples {posargs}
>>>>>>> master
[testenv:pre-commit]
basepython = python3.11