Get the latest tech news

Coverage.py Regex Pragmas


Coverage.py uses regexes to define pragma syntax. This is surprisingly powerful.

By adding def __repr__ as an exclusion regex, all of those methods were automatically excluded from coverage measurement without having to add a comment to each one. Not only did this let people add custom exclusions in their projects, but it enabled third-party plugins that could configure regexes in other interesting ways: So regexes aren’t perfect, but they’re a pretty good balance: flexible and powerful, and will work great on real code even if we can invent weird edge cases where they fail.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Coverage.py

Coverage.py