Board test suite for CircuitPython. Run these tests to ensure that a CircuitPython port was created correctly, individual pin mappings are correct, and buses (e.g. SPI) work.
Tests can be run individually. Copy code found in each boardtest_<name>.py module to your CIRCUITPYTHON device drive, and rename the file code.py.
Alternatively, tests can be imported as modules. Copy the desired test file to CIRCUITPYTHON device drive and import the test in your own code. Each test can be run with the
The boardtest_suite.py (in examples/) shows how to call tests from within a script. boardtest_suite.py runs the following tests:
- LED Test
- GPIO Test
- Voltage Monitor Test
- UART Test
- SPI Test
- I2C Test
This test suite depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
You will need the following components:
- 1x LED
- 1x 330 Ohm resistor or 220 Ohm resistor
- 2x 4.7k Ohm resistor
- Microchip 25AA040A SPI EEPROM
- Microchip AT24HC04B I2C EEPROM
Connect the components as shown to your board. Note that you can use a 220 Ohm or 330 Ohm resistor for the LED.
To use each test, copy the individual .py or .mpy test(s) into a folder named adafruit_boardtest in the CIRCUITPY drive, import the library, find the pins available on your board, and call
boardtest_<test name>.run_test(pins). To run the GPIO test, for example:
import board from adafruit_boardtest import boardtest_gpio # List out all the pins available to us pins = [p for p in dir(board)] print() print("All pins found:", end=' ') # Print pins for p in pins: print(p, end=' ') print('\n') # Run test result = run_test(pins) print() print(result) print("Pins tested: " + str(result))
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Zip release files
To build this library locally you'll need to install the circuitpython-build-tools package.
python3 -m venv .env source .env/bin/activate pip install circuitpython-build-tools
Once installed, make sure you are in the virtual environment:
Then run the build:
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-boardtest --library_location .
Sphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):
python3 -m venv .env source .env/bin/activate pip install Sphinx sphinx-rtd-theme
Now, once you have the virtual environment activated:
cd docs sphinx-build -E -W -b html . _build/html
This will output the documentation to
docs/_build/html. Open the index.html in your browser to
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
locally verify it will pass.