mercredi 19 juin 2019

How to make a Python script to print stdout directly? [duplicate]

This question already has an answer here:

When I call a Python unit test I can see all the stdout directly e.g. how remote APIs are called etc., if I use the -s switch.

python3 -m pytest -s some_test.py

However if I run a script with same code which I prototyped in the test script, the stdout comes only at the end.

python3 script.py

How to make script.py to print to stdout as it comes from pytest?

Aucun commentaire:

Enregistrer un commentaire