Skip to content

Provide users a way to exit on error if exceeded the maximum configured warnings #14371

@miketheman

Description

@miketheman

What's the problem this feature will solve?

I had written a plugin pytest-max-warnings to exit with an error to help users set expectations of ratcheting down warnings

Describe the solution you'd like

When a user runs their pytest test suite with either a CLI flag of --max warnings N, or a config file max_warnings = N where N is an integer, at the end of their test run, the test run will fail if the amount of warnings emitted exceeds N.

Alternative Solutions

I wrote a plugin, now want to move it into core.

Additional context

Tagging @graingert who suggested the plugin could be merged into pytest as-is a while back, so now I'm raising an issue so I can implement that, with maybe some improvments around configuration and exit codes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions