summaryrefslogtreecommitdiff
path: root/tests/test_mypy.py
Commit message (Collapse)AuthorAgeFilesLines
* Reformatting with BlackSybren A. Stüvel2021-03-291-7/+7
| | | | No functional changes.
* Fix hashlib mypy types for Python 3.xSaif Hakim2021-03-241-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As captured in https://github.com/python/typeshed/pull/1663, the types for SHA-1 and SHA-2 family of functions are callables that return a Hash instance, whilst the SHA-3 family of functions are Hash `type`s (at least in Python 3.6). Mixing the two kinds of functions together in a dictionary confuses mypy's type inference as noted in #153, so we instead add an annotation as a hint. Also, update test_my.py to match the python version set by tox.ini in CI instead of always targeting Python 3.7 (as configured in setup.cfg) to validate the types in all supported Python 3.x versions. This fix also avoids the issue with the older mypy releases for Python 3.6 / Python 3.7 found in distro repos... ... for Ubuntu: ``` docker run \ -v $(pwd):/tmp/rsa \ -w /tmp/rsa ubuntu:18.04 \ /bin/bash -c 'apt-get update -qqy \ && apt-get install -qqy python3-pyasn1 python3-setuptools python3-mypy \ && python3 setup.py test' ``` ... and for Fedora: ``` docker run \ -v $(pwd):/tmp/rsa \ -w /tmp/rsa docker.io/fedora \ /bin/bash -c 'dnf -y install wget python3-devel python3-pyasn1 python3-setuptools python3-mypy \ && python3 setup.py test' ``` Fixes #153
* Compatibility with newer MyPy versionsSybren A. Stüvel2020-06-111-1/+1
| | | | The newer versions always have a message, even on success.
* Added mypy for static type checkingSybren A. Stüvel2019-08-041-0/+27