1

Usint pytest on Pycharm, I have some long tests for which I want to be able to manually monitor progress of.
Things like neural network training - I want to see loss and progress bar.

Running the same code from a regular function like main() gives console output fine.

Running through a pytest test doesn't put anything to console until the test is over.


How to make pytest still output to console in Pycharm?

I found this answer and tried -s and --capture=tee-sys which do basically nothing.


Feb 03 2021 Just asked on pycharm's forum.

Gulzar
  • 17,272
  • 18
  • 86
  • 144

1 Answers1

2

add -s to your Additional Arguments in the Run/Debug Configuration.

This will disable the default pytest stdout/stderr capturing.

MrBean Bremen
  • 12,145
  • 3
  • 19
  • 36
Lior Cohen
  • 5,227
  • 1
  • 13
  • 28
  • More detail: I am trying to run a pytorch-lightning test, and some of the tests are long. I have to wait to the end of the run to see the result. `-s` doesn't work. Easily reproducible by downloading their open source https://github.com/PyTorchLightning/pytorch-lightning and running a test. – Gulzar Feb 03 '21 at 12:11
  • `-s` doesn't work for me. I still have to wait for the test to end if I want to see the output in the run window. – Gulzar Feb 03 '21 at 12:41