Skip to content

junit-xml: add option for disabling logs for passed tests #4559

@yoshi-lyosha

Description

@yoshi-lyosha

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: junitxmlrelated to the junitxml builtin pluginstatus: help wanteddevelopers would like help from experts on this topictype: enhancementnew feature or API change, should be merged into features branchtype: feature-branchnew feature or API change, should be merged into features branchtype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions