Merge branch 'master' into pytest-8

This commit is contained in:
Erik Wrede 2024-06-22 12:16:38 +02:00 committed by GitHub
commit 386716b113
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 29 additions and 37 deletions

View File

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

View File

@ -1,2 +1,2 @@
[settings] [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

15
SECURITY.md Normal file
View File

@ -0,0 +1,15 @@
# Security Policy
## Supported Versions
Support for security issues is currently provided for Graphene 3.0 and above. Support on earlier versions cannot be guaranteed by the maintainers of this library, but community PRs may be accepted in critical cases.
The preferred mitigation strategy is via an upgrade to Graphene 3.
| Version | Supported |
| ------- | ------------------ |
| 3.x | :white_check_mark: |
| <3.x | :x: |
## Reporting a Vulnerability
Please use responsible disclosure by contacting a core maintainer via Discord or E-Mail.

View File

@ -59,7 +59,7 @@ When we send a **Query** requesting only one **Field**, ``hello``, and specify a
Requirements 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) - Graphene (3.0)
Project setup Project setup

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc # snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot from snapshottest import Snapshot
snapshots = Snapshot() snapshots = Snapshot()

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc # snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot from snapshottest import Snapshot
snapshots = Snapshot() snapshots = Snapshot()

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc # snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot from snapshottest import Snapshot
snapshots = Snapshot() snapshots = Snapshot()

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc # snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot from snapshottest import Snapshot

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
import datetime import datetime
import os import os
import subprocess import subprocess

View File

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

View File

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

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from decimal import Decimal as _Decimal from decimal import Decimal as _Decimal
from graphql import Undefined from graphql import Undefined

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
from graphql.language.ast import ( from graphql.language.ast import (
BooleanValueNode, BooleanValueNode,
FloatValueNode, FloatValueNode,

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
import json import json
from graphql import Undefined from graphql import Undefined

View File

@ -1,4 +1,3 @@
from __future__ import absolute_import
from uuid import UUID as _UUID from uuid import UUID as _UUID
from graphql.language.ast import StringValueNode from graphql.language.ast import StringValueNode

View File

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

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py3{8,9,10,11}, mypy, pre-commit envlist = py3{8,9,10,11,12}, mypy, pre-commit
skipsdist = true skipsdist = true
[testenv] [testenv]
@ -8,7 +8,7 @@ deps =
setenv = setenv =
PYTHONPATH = .:{envdir} PYTHONPATH = .:{envdir}
commands = commands =
py{38,39,310,311}: 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}
[testenv:pre-commit] [testenv:pre-commit]
basepython = python3.10 basepython = python3.10