Coverage 4.5

Sunday 4 February 2018This is almost seven years old. Be careful.

Just out: coverage.py v4.5.

There’s one new feature: configurator plug-ins, that let you run Python code at startup to set the configuration for coverage. This side-steps a requested feature to have different exclusion pragmas for different versions of Python.

People wanted to be able to say, this line of code is excluded from coverage when run under Python 3, but not under Python 2. That sounds simple enough, but then some wanted to be able to exclude for Python 3.5, but not 3.6. Or, excluded when running under PyPy, but not under CPython.

I could see this turning into a never-ending road of finer and finer differentiation. Next would be operating systems, or versions of Django, or, etc, etc, etc.

Rather than me building all that into coverage itself, now you can write your own plug-in that makes all those determinations, and sets the exclude pragmas as you like.

Comments

[gravatar]
Terry Jan Reedy 9:20 PM on 4 Feb 2018
Nice. idlelib has OS-specific code and once had code dependent on tcl/tk version and might again.
[gravatar]
Awesome Post. I was surfing the Internet for information and went over your blog. I am awed by the information you have on this blog. Thanks a lot for sharing this!

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.