PyTest: Interactive Output (instead of pure ASCII)

For achieving an output similar to the screenshot (which I assume is from a Django debugging session), you will need pytest and the pytest-html plugin.

You invoke pytest using this command line.

pytest --showlocals --html=report.html --self-contained-html testmodule/test.py

This will give you a HTML report with a nice overview of collapsible tests. Passing the argument --showlocals will also be reflected in the HTML report. All failed tests will show the local variable scope.

I created a small example repository with further instructions.

HTML report example

Tags:

Python

Pytest