Skip to content

warnings: better handle errors raised while applying filterwarnings #7864

@bluetech

Description

@bluetech

Refs: pytest-dev/pytest-django#874

The apply_warning_filters() function, called during pytest initialization to parse filterwarnings ini among others, imports the module of the indicated warning type, which can raise. If the import fails, pytest crashes with an ugly traceback (see referenced issue). We should probably catch the exception and raise a nicer message (while still displaying the original traceback somehow).

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: warningsrelated to the warnings builtin plugintopic: configrelated to config handling, argument parsing and config file

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions