I have been over and over the documentation, but I can not fine out how I get py.test to write to the log for tests that pass. For example if I run "py.test --resultlog=mylog.txt myPytest.py" mylog.txt only has one line for each test that passed. I want to add other things to each test recorded in my log file, regardless whether thy passed or failed. For example I need to know the time they ran, some of the output data etc. How do I get py.test to include data about the test (passed and failed) in the py.test log file?
pytest now supports the -s argument to prevent capturing logging calls for passing tests.
pytest -s
From the documentation:
-s, –capture=no Normally stdout and stderr are captured and only shown for failing tests. The -s option can be used to disable capturing, showing stdcalls for print statements, logging calls, etc.
You can have a look if the junitxml output provides any more information. But I suspect that if you want the actual time rather then duration etc you will have to write your own plugin. The documentation gives you the relevant hooks: http://pytest.org/latest/plugins.html?highlight=hooks#reporting-hooks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With