From d1986495e588df7003797b210995e676d5139cab Mon Sep 17 00:00:00 2001 From: Spencer Nelson Date: Wed, 20 May 2020 10:06:27 -0700 Subject: [PATCH] Don't run mypy on pypy because it can't be installed See https://github.com/python/typed_ast/issues/111 for more. --- developer_requirements.txt | 2 +- run-tests.sh | 12 ++++++++++-- setup.py | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/developer_requirements.txt b/developer_requirements.txt index f08ae9e2..4279b631 100644 --- a/developer_requirements.txt +++ b/developer_requirements.txt @@ -10,7 +10,7 @@ twine coverage codecov python-dateutil -mypy; python_version >= '3.5' +mypy; python_version >= '3.5' and implementation_name != "pypy" # codec libraries (snappy is intentionally left off this list as it requires other system libraries to be installed and is non-trivial) # Also don't install on windows for similar reasons diff --git a/run-tests.sh b/run-tests.sh index fb596b25..422c6989 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -13,11 +13,19 @@ echo "running flake8" flake8 fastavro tests flake8 --config=.flake8.cython fastavro -if [[ "$(python --version)" =~ "Python 3" ]]; then + +RUN_MYPY=$(python -c `import sys +if sys.version_info[0] >= 3 and sys.implementation.name != "pypy": + sys.stdout.write("yes") +else: + sys.stdout.write("no") +`) + +if [[ "$RUN_MYPY" -eq "yes" ]]; then echo "running mypy" mypy ./fastavro else - echo "skipping mypy in Python 2" + echo "skipping mypy" fi check-manifest diff --git a/setup.py b/setup.py index 4faa20d1..36d706de 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ def version(): setup_requires += cpython_requires tests_require = ['pytest', 'flake8', 'check-manifest'] -if sys.version_info >= (3, 0): +if sys.version_info >= (3, 0) and sys.implementation.name != "pypy": tests_require.append('mypy') setup(