Description
We have near 130k tests for some web-API, and in these tests we log a lot of http requests with its request/response headers, data, query and etc. We are logging it with logging module (logging.getLogger('api_logger')
). There is a lot of logs, really. We are using Jenkins to run these tests and --junit-xml
option for creating junit-xml style report.
So the problem is connected with junit-xml creation. Junit-xml reporter captures not only failed tests (<1%) but passed tests too (>99%) and it can crash the Jenkins process and freeze the runner-server for a while.
There are some ways to disable logs for failed tests like:
--show-capture=no
Controls how captured stdout/stderr/log is shown on failed tests. Default is 'all',--no-print-logs
disable printing caught logs on failed tests,
but no possibility to disable logs for passed test.
Right now we handle this with custom pytest_runtest_logreport
that checks if report.failed and report.when == 'call'
So, maybe pytest needs an option for junit-xml that disables logs for passed tests and logs only failed, what do you think?