These examples are based on EuroPython Conference's YouTube video titled Alexander Steffen - Writing unit tests for C code in Python. The primary additional resources are as follows:
- CFFI (C Foreign Function Interface) documentation
importlib
— The implementation ofimport
*unittest
— Unit testing framework*
To run an example unit test, from the command line, ...
- Navigate into the directory containing the test script (e.g.,
./examples/1_single_test
) - Execute
python3 -m unittest <script name (e.g., add_ints_test.py)> -v