From b62d7f3e84cc648dbfca070c61831f4a650b74c9 Mon Sep 17 00:00:00 2001 From: Florian Briand Date: Mon, 26 Nov 2018 10:44:43 +0100 Subject: [PATCH 1/5] Use enum34 backport when Enum is not available --- setup.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index cfbae111..175bd20f 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,19 @@ ast.literal_eval(_version_re.search(f.read().decode("utf-8")).group(1)) ) +requirements = [ + # To keep things simple, we only support newer versions of Graphene + "graphene>=2.1.3,<3", + # Tests fail with 1.0.19 + "SQLAlchemy>=1.1,<2", + "six>=1.10.0,<2", + "singledispatch>=3.4.0.3,<4", +] +try: + import Enum +except ImportError: + requirements.append("enum34 >= 1.1.6") + tests_require = [ "pytest==4.3.1", "mock==2.0.0", @@ -42,14 +55,7 @@ ], keywords="api graphql protocol rest relay graphene", packages=find_packages(exclude=["tests"]), - install_requires=[ - # To keep things simple, we only support newer versions of Graphene - "graphene>=2.1.3,<3", - # Tests fail with 1.0.19 - "SQLAlchemy>=1.1,<2", - "six>=1.10.0,<2", - "singledispatch>=3.4.0.3,<4", - ], + install_requires=requirements, extras_require={ "dev": [ "tox==3.7.0", # Should be kept in sync with tox.ini From 9aa3fbaf08d3d3ac96b6f754e84f53b47e56e832 Mon Sep 17 00:00:00 2001 From: Florian Briand Date: Mon, 26 Nov 2018 11:16:09 +0100 Subject: [PATCH 2/5] Launch pytest with python setup.py test command --- setup.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.cfg b/setup.cfg index 4e863d7a..88221f21 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,6 @@ +[aliases] +test=pytest + [flake8] exclude = setup.py,docs/*,examples/*,tests max-line-length = 120 From 0d8a9912c1a25520b10dc661e28a0c52df7d7d03 Mon Sep 17 00:00:00 2001 From: Florian Briand Date: Mon, 26 Nov 2018 12:58:59 +0100 Subject: [PATCH 3/5] fixup! Use enum34 backport when Enum is not available --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 175bd20f..a87d3d08 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ "singledispatch>=3.4.0.3,<4", ] try: - import Enum + import enum except ImportError: requirements.append("enum34 >= 1.1.6") From 2db8fef88e959398a7a30c28031c1037d73d4886 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Wed, 27 Mar 2019 15:47:56 +0100 Subject: [PATCH 4/5] Add comment about version for ImportError Co-Authored-By: Nabellaleen --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a87d3d08..0648381c 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ ] try: import enum -except ImportError: +except ImportError: # Python < 2.7 and Python 3.3 requirements.append("enum34 >= 1.1.6") tests_require = [ From a61580a70fd3da781c6264de258f6cc242ec43c4 Mon Sep 17 00:00:00 2001 From: Florian Briand Date: Fri, 29 Mar 2019 22:23:00 +0100 Subject: [PATCH 5/5] Restore python2.7 testing --- .travis.yml | 6 ++---- tox.ini | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 33704975..39151a5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,8 @@ language: python matrix: include: # Python 2.7 - # TODO Fix enum and add back tests for py27 - # See https://github.com/graphql-python/graphene-sqlalchemy/pull/177 - # - env: TOXENV=py27 - # python: 2.7 + - env: TOXENV=py27 + python: 2.7 # Python 3.5 - env: TOXENV=py34 python: 3.4 diff --git a/tox.ini b/tox.ini index b6b6ab1c..e55f7d9b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = pre-commit,py{34,35,36,37}-sql{11,12,13} +envlist = pre-commit,py{27,34,35,36,37}-sql{11,12,13} skipsdist = true minversion = 3.7.0