Sunday 12 December 2004 — This is 20 years old. Be careful.
After a long and feverish ten days spent poring over Python parse trees, I have an updated coverage.py to offer.
It does a better job identifying executable statements than the original version by Gareth Rees, which was confused by docstrings and global statements. And you can use code markers to exclude lines or suites from consideration as executable statements.
Enjoy!
In the end, this job required a three-pronged attack to get everything I needed out of a Python module. Line-oriented regular expressions found the exclusion markers, the parser module told me about tokens and line numbers, and the compiler module told me about execution semantics. There may be an easier way to get all the information I needed, but I couldn’t find it.
Comments
Add a comment: