HiveBrain v1.2.0
Get Started
← Back to all entries
snippetpythonpytestCritical

How to see normal stdout/stderr console print() output from code during a pytest run?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
howstderrconsoleseestdoutprintrunduringoutputfrom

Problem

Sometimes I want to just insert some print statements in my code, and see what gets printed out when I exercise it. My usual way to "exercise" it is with existing pytest tests. But when I run these, I don't seem able to see any standard output (at least from within PyCharm, my IDE).

Is there a simple way to see standard output during a pytest run?

Solution

The -s switch disables per-test capturing (only if a test fails).

-s is equivalent to --capture=no.

Context

Stack Overflow Q#14405063, score: 1173

Revisions (0)

No revisions yet.