circuitpython/tools/test-stubs.sh

13 lines
536 B
Bash
Raw Normal View History

#!/bin/sh -e
rm -rf test-stubs
python3 -m venv test-stubs
. test-stubs/bin/activate
2023-05-09 22:31:24 -04:00
pip install mypy isort black adafruit-circuitpython-typing wheel build
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)"