Skip to content

Commit ebbd064

Browse files
author
Conglei Shi
committed
change tox
1 parent ea3f319 commit ebbd064

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

graphene_pydantic/converters.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,11 @@ def convert_pydantic_field(
130130
# from the field's base model
131131
# - maybe even (Sphinx-style) parse attribute documentation
132132
field_kwargs.setdefault("description", field.field_info.description)
133-
134-
field_type = field_kwargs.pop("type")
135-
if "type_" in field_kwargs:
136-
field_type = field_kwargs.pop("type_")
133+
134+
# Handle Graphene 2 and 3
135+
field_type = field_kwargs.pop("type", field_kwargs.pop("type_", None))
136+
if field_type is None:
137+
raise ValueError("No field type could be determined.")
137138

138139
return Field(field_type, resolver=get_attr_resolver(field.name), **field_kwargs)
139140

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ keywords = ["api", "graphql", "protocol", "rest", "relay", "graphene", "pydantic
2424
[tool.poetry.dependencies]
2525
python = "^3.7"
2626
# To keep things simple, we only support newer versions of Graphene & Pydantic
27-
graphene = "~=3.0"
27+
graphene = ">=2.1.8"
2828
pydantic = [
2929
{ version = ">=1.0,<2.0", python = ">3.6,<3.10" },
3030
{ version = ">=1.9,<2.0", python = "~3.10" }

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://tox.readthedocs.io/en/latest/example/basic.html#compressing-dependency-matrix
22
[tox]
33
# NOTE: Pydantic <1.9 does not support Python 3.10
4-
envlist = py{37,38,39}-graphene{30}-pydantic{17,18,19}, py310-graphene30-pydantic19
4+
envlist = py{37,38,39}-graphene{21,30}-pydantic{17,18,19}, py310-graphene30-pydantic19
55
# CI will supply any versions not available locally
66
skip_missing_interpreters = True
77
# required if working with pyproject.toml
@@ -12,6 +12,7 @@ requires =
1212
[testenv]
1313
whitelist_externals = poetry
1414
deps =
15+
graphene21: graphene>=2.1.8
1516
graphene30: graphene>=3.0,<3.1
1617
pydantic17: pydantic==1.7
1718
pydantic18: pydantic==1.8

0 commit comments

Comments
 (0)