When I put `print` statements inside a unit test case I don't see any output in the console window. Any idea of why this might be?I know it's not the most elegant way to debug, but sometimes the quickest way to get some info about a variable when debugging some Trac code, particularly since I'm still a beginning with python and not proficient with pdb and other tools that exist.
Maybe stdout is redirect somewhere else
or your messages areentangled in the tons of prose output by unittest runners , ...
You
should use the log in functional tests and anywhere you have access to
an environment (<= indeed if that's the case those will be functional
tests already ;) .
If you provide further details the response might be more accurate .
;)
[...]
You
should use the log in functional tests and anywhere you have access to
an environment (<= indeed if that's the case those will be functional
tests already ;) .I don't follow. How does this help me debug a unit test?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[...]
I do add print statements to unit test quite often to speed-up debugging
recently. So I can confirm that they do work. In fact I've found them to
work most of the time, but not always. Still I've discovered other ways
to get to data from places, where print statements don't work.
[...]
If you want to inspect what happens in a test, then spend the half hour necessary to learn basic pdb. It is not scary at all, and most of the time you can just consider it an interactive interpreter.