circuitpython/tools/test-stubs.sh
Jeff Epler f51ca53553 refine stubs-building procedure
* so that excess files are not included in sdist, perform build down
   in circuitpython-stubs
 * This means we need to
   * Remove the need-pypi check
   * Copy a setup.py, README, and MANIFEST.in into the stubs build location
   * Revamp how the overall `mypy --strict` check lists its inputs
 * Add a new test that actually installing the stubs lets us do type
   checking (tools/test-stubs.sh)
 * Add a missing return type to a __init__ function (why was this not
   an error under `mypy --strict`, I wonder)
2021-06-22 08:59:05 -05:00

13 lines
499 B
Bash
Executable File

#!/bin/sh -e
rm -rf test-stubs
python3 -mvenv test-stubs
. test-stubs/bin/activate
pip install mypy isort black wheel
rm -rf circuitpython-stubs .mypy_cache
make stubs
pip install --force-reinstall circuitpython-stubs/dist/circuitpython-stubs-*.tar.gz
mypy -c 'import busio; b: busio.I2C; b.writeto(0x30, b"")'
! mypy -c 'import busio; b: busio.I2C; b.readfrom_into(0x30, b"")'
! mypy -c 'import busio; b: busio.I2C; b.write(0x30, b"")'
echo "(The above two tests are expected to show type errors)"