Merge branch 'master' into contributing

This commit is contained in:
Paul Hallett 2019-05-07 20:29:14 +01:00 committed by GitHub
commit 226a14aba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 7 deletions

View File

@ -3,8 +3,6 @@ matrix:
include: include:
- env: TOXENV=py27 - env: TOXENV=py27
python: 2.7 python: 2.7
- env: TOXENV=py34
python: 3.4
- env: TOXENV=py35 - env: TOXENV=py35
python: 3.5 python: 3.5
- env: TOXENV=py36 - env: TOXENV=py36

View File

@ -143,4 +143,5 @@ https://docs.graphene-python.org/en/latest/
## Contributing ## Contributing
See [Contributing](CONTRIBUTING.md) See [Contributing](CONTRIBUTING.md)

View File

@ -0,0 +1,8 @@
import graphene
def test_issue():
options = {"description": "This my enum", "deprecation_reason": "For the funs"}
new_enum = graphene.Enum("MyEnum", [("some", "data")], **options)
assert new_enum._meta.description == options["description"]
assert new_enum._meta.deprecation_reason == options["deprecation_reason"]

View File

@ -46,7 +46,12 @@ class EnumMeta(SubclassWithMeta_Meta):
def __call__(cls, *args, **kwargs): # noqa: N805 def __call__(cls, *args, **kwargs): # noqa: N805
if cls is Enum: if cls is Enum:
description = kwargs.pop("description", None) description = kwargs.pop("description", None)
return cls.from_enum(PyEnum(*args, **kwargs), description=description) deprecation_reason = kwargs.pop("deprecation_reason", None)
return cls.from_enum(
PyEnum(*args, **kwargs),
description=description,
deprecation_reason=deprecation_reason,
)
return super(EnumMeta, cls).__call__(*args, **kwargs) return super(EnumMeta, cls).__call__(*args, **kwargs)
# return cls._meta.enum(*args, **kwargs) # return cls._meta.enum(*args, **kwargs)

View File

@ -76,10 +76,9 @@ setup(
"Programming Language :: Python :: 2", "Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: PyPy",
], ],
keywords="api graphql protocol rest relay graphene", keywords="api graphql protocol rest relay graphene",
@ -88,7 +87,7 @@ setup(
"six>=1.10.0,<2", "six>=1.10.0,<2",
"graphql-core>=2.1,<3", "graphql-core>=2.1,<3",
"graphql-relay>=0.4.5,<1", "graphql-relay>=0.4.5,<1",
"aniso8601>=3,<4", "aniso8601>=3,<=6.0.*",
], ],
tests_require=tests_require, tests_require=tests_require,
extras_require={ extras_require={

View File

@ -9,7 +9,7 @@ deps =
setenv = setenv =
PYTHONPATH = .:{envdir} PYTHONPATH = .:{envdir}
commands = commands =
py{27,34,py}: py.test --cov=graphene graphene examples {posargs} py{27,py}: py.test --cov=graphene graphene examples {posargs}
py{35,36,37}: py.test --cov=graphene graphene examples tests_asyncio {posargs} py{35,36,37}: py.test --cov=graphene graphene examples tests_asyncio {posargs}
[testenv:pre-commit] [testenv:pre-commit]