Hi team, I used the Python `logging` library to lo...
# general
p
Hi team, I used the Python
logging
library to log messages for tests. But I didn't see any output messages even though I applied the
-ldebug
option, e.x. "./pants -ldebug test ...". Does anyone know how to see the logging outputs? Thanks!
w
Is this in your tests? Are you using
caplog
?
p
Yes this is my test. I am logging, ex.
import logging
,
<http://logging.info|logging.info>(...)
h
Run with
--test-output=all
, otherwise we suppress the output of tests that pass
p
OK
h
Does that work?
p
No it doesn't. I still do not see the output.
It is not blocking anyways.
Also, the "--test-output=all" option already generates helpful information. I am debugging a slow unit test in our CI pipeline, and with this logging option, I am able to nail down the costly part to be building
requirements.pex
instead of the running the test itself.
h
Oh, wait, you also need to tell pytest to show output from passing tests.
You pass
-s
to pytest for that
so
./pants test --output=all <targets> -- -s
p
It worked like a charm! Thanks Benjy!