Test coverage for Python C modules
It's actually pretty easy to get some coverage statistics of C code, even with Python. You've just gotta grip it.
First, you shouldn't write half a script duplicating Tools/freeze/freeze.py in the Python distribution. Freezing for C libraries equals statically compiling! It's true.
Here's what I did, rougly:
- Copy my C extension's C file and header to
Modules/; - edit
Modules/Setup.local, include a line sayingfoo foomodule.c -lblah; make clean./config.status --recheckmake coverage./python.exe ~/path/to/tests.pygcov -o foomodule
So by the way, I have about 65% test coverage in pylibmc.
Comments
