pytest-dev / pytest-html

Plugin for generating HTML reports for pytest results
Other
689 stars 234 forks source link

Output the stdout in the use case to the console and html report at the same time #438

Open wangqian0818 opened 3 years ago

wangqian0818 commented 3 years ago

I‘m useing pytest-html and find the plugin generally fantastic. But I have been in contact with pytest-html for a short time. During the use, I found that adding the'-s' parameter to the pytest command can display the standard output of the use case to the console, but the standard output of the html report cannot be captured. With the'--capture=sys' parameter, the html report is captured, but the standard output in the console disappears. Is there any way to display it in the console and html report at the same time?

fenchu commented 3 years ago

with pytest-html3.x.x -s --capture=sysgive you all. if you pytest-html 2.1.1 you can finegrain the various combinations

fenchu commented 3 years ago

We really miss ways to finegrain output. --capture=fd and tuning the logging so it only output a stderr files, no stdout file is my current workaround. But it is not sustainable because I like logging and output to be exactly like in production. (We often search for errors in test system if we see them in prod)