“A commanding view of your test-coverage”.

The tool cuv provides console tools to show coverage data for you Python project nicely in the console. It uses colour and unicode characters.

cuv can:

  • graph coverage of all files in your project;
  • colour-ize individual source-code files (via less) by their coverage;
  • colour-ize diff (or e.g. git diff master..HEAD) by coverage
  • diff .coverage files themselves

Command Documentation

cuv graph

Usage: cuv graph [OPTIONS] [KEYWORD]...

Console graph of each file’s coverage.

  • --help: Show this message and exit.
console graph, showing txtorcon code

cuv lessopen

Usage: cuv lessopen [OPTIONS] [INPUT_FILE]

Syntax + coverage highlighting in console.

Set ‘less’ up to use this via the LESSOPEN var:

   export LESSOPEN='| cuv lessopen %s'

or if you prefer:

   export LESSOPEN='| python -m cuv lessopen %s'

You may need to provide the full path to ‘cuv’. Now, whenever you‘less’ a file within a project that has coverage data, it will besyntax-highlighted and coloured according to coverage.

  • --help: Show this message and exit.
pygments + coverage coloring in console

cuv diff

Usage: cuv diff [OPTIONS] [INPUT_FILE]

Color a diff by its coverage.

This prints out the whole diff as you would expect, but any added(“+”) lines in the diff get a red background if they are notcovered.

For example, to see if your local changes are covered in a Gitcheckout:

   git diff | cuv diff -

To see if your whole branch is covered:

   git diff master...HEAD | cuv diff -

  • --help: Show this message and exit.
showing "cuv diff" colouring

cuv next

Usage: cuv next [OPTIONS]

Display the next uncovered chunk.

This finds the next file that has some uncovered lines and thenruns:

   cuv lessopen <filename> | less -p \u258c -j 4

  • --ignore TEXT:
  • -N, --line-numbers:
  • --help: Show this message and exit.
showing "cuv next" for above 'graph' screenshot

cuv spark

Usage: cuv spark [OPTIONS] [KEYWORD]...

Single-line terminal graph of coverage.

  • --sort / --no-sort:
  • --help: Show this message and exit.
spark-line coverage of txtorcon

cuv readme

Usage: cuv readme [OPTIONS]

View the README

  • --help: Show this message and exit.