From ee3279e12b337f94f0e52ff0496b6c403e6b46c8 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Wed, 28 Oct 2015 01:30:39 -0700 Subject: [PATCH] Added caching to travis tests --- .travis.yml | 5 +++-- graphene/utils/misc.py | 10 ++++++++++ tests/django_settings.py | 1 - 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 graphene/utils/misc.py 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', ]