How to run pytest via pycharm and have all output in the run window, during the test run?
I am trying to run a pytest test that takes a long time to run, and has some prints to stdout/stderr which I want to be able to see.
All I could find regarding this was this SO answer
According to that answer, I can specify `-s` under run configurations > additional arguments.
Another answer claims `--capture=tee-sys` will solve that issue.
Both fail, and I have to wait for the test to finish in order to see output. This greatly hinders development, as I can't quickly see results, and am forced to create a regular script which is not a pytest in order to debug my code, then copy it as a test.
For reproducibility, I am referring to Pytorch-lightning's tests.
How can I see pytest output *during the test run*?
Please sign in to leave a comment.
I believe you can do this using pytest's inbuilt capsys fixture without any special command line options. If you try running the following as a test in PyCharm. Unfortunately the final output still rather garbled with the debug statements from the test that passes being shown erroneously, but while running it's quite nice I think.