diff --git a/.travis.yml b/.travis.yml index f4d6a6bf..38d505e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,10 @@ python: - 3.4 - 3.5 - pypy +cache: pip install: -- pip install pytest pytest-cov coveralls flake8 six blinker pytest-django -- pip install -e .[django] +- pip install --cache-dir $HOME/.cache/pip pytest pytest-cov coveralls flake8 six blinker pytest-django +- pip install --cache-dir $HOME/.cache/pip -e .[django] - python setup.py develop script: - py.test --cov=graphene diff --git a/graphene/utils/misc.py b/graphene/utils/misc.py new file mode 100644 index 00000000..b0dee69d --- /dev/null +++ b/graphene/utils/misc.py @@ -0,0 +1,10 @@ +from collections import OrderedDict +from graphql.core.type import GraphQLEnumType, GraphQLEnumValue + + +def enum_to_graphql_enum(enumeration): + return GraphQLEnumType( + name=enumeration.__name__, + values=OrderedDict([(it.name, GraphQLEnumValue(it.value)) for it in enumeration]), + description=enumeration.__doc__ + ) diff --git a/tests/django_settings.py b/tests/django_settings.py index 4614caae..d8f90141 100644 --- a/tests/django_settings.py +++ b/tests/django_settings.py @@ -1,7 +1,6 @@ SECRET_KEY = 1 INSTALLED_APPS = [ - 'graphene.contrib.django', 'examples.starwars_django', 'tests.contrib_django', ]