1

I am running some tests with pytests. These tests have print statements. However when all the tests pass, no info is ever printed. It is only when a test fails that along with the info about the failure, all prints that were executed get printed.

Is there a way to print info while the test run even when it passes?

KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • 1
    Does this answer your question? [How can I see normal print output created during pytest run?](https://stackoverflow.com/questions/14405063/how-can-i-see-normal-print-output-created-during-pytest-run) – MrBean Bremen Jun 15 '20 at 13:47

2 Answers2

1

You can use the -s option

Another way how you can see all print statements is to have a look into degenrated outputs, e.g. if you're using html reports or html1 reports, print statements are always captured there even when tests pass.

pavelsaman
  • 7,399
  • 1
  • 14
  • 32
  • Thanks. I tried it, and yes it prints the prints of the test. But unfortunately it also prints the prints of the system I am testing. – KansaiRobot Jun 16 '20 at 12:12
0

You can add as command line argument --verbose or shortly -v to see whole log. It will include all steps: passed, failed, skipped and etc.

Andrei
  • 46
  • 4