All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

How Coverage.py Uses Regexes for Flexible Code Exclusion

By

xrayarx

10mo ago· 4 min readen

Summary

Coverage.py utilizes regexes to define pragma syntax for excluding code from measurement, offering flexibility and power in its implementation. Unlike other tools with fixed syntax, Coverage.py allows users to modify or add regexes, enhancing its adaptability.

Key quotes

· 4 pulled
Coverage.py lets you indicate code to exclude from measurement by adding comments to your Python files.
Rather than having fixed syntax for these comments, they are defined using regexes that you can change or add to.
This has been surprisingly powerful.
Coverage finds lines in your source files that match the regexes. These lines are excluded from measurement.
Snippet from the RSS feed
Coverage.py uses regexes to define pragma syntax. This is surprisingly powerful.

You might also wanna read