cuv’ner

“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 report

Usage: cuv report [OPTIONS] [INPUT_FILE]

Produce a report about a diff

This summarizes any increases or decreases in coverage for aparticular patch (e.g. from "git diff") or branch.

For example, report on your whole current branch:

   git diff master...HEAD | cuv report -

  • --help: Show this message and exit.

cuv diffcuv

Usage: cuv diffcuv [OPTIONS] INPUT_FILES...

Difference between two given .coverage files.

This will show you which lines are covered by one of the coveragefiles but not the other (or vice-versa).

  • --help: Show this message and exit.

cuv watch

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

Console graph of each file's coverage.

  • --help: Show this message and exit.

cuv next

Usage: cuv next [OPTIONS] [FNAMES]...

Display the next uncovered chunk.

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

   cuv lessopen <filename> | less -p ▌ -j 4

..which means you can keep pressing 'n' to see the next uncoveredline. If you include an argument, only files with that arg in thename are considered as "next".

  • --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.