Python unit-testing: view annotated coverage report in terminal

I’m using Python’s unittest for testing, and I know I can view per-source-file annotated coverage report in browser by exporting it to HTML files with:

coverage run -m unittest *_test.py
coverage html

But I want to view this in Linux/Unix command line: view a given source file, with covered lines marked with green, and missed lines marked with red.

I tested several terminal web browsers (w3m, links, elinks, links2) and none of them can display these html files in a readable manner.

Maybe I’m missing something, because it looks like a very obvious feature to have in "coverage" or "green" or other testing tools, but I can’t find anything!

Source: Python Questions

LEAVE A COMMENT