Hello all, I recently opened a feature request for pytest (https://github.com/pytest-dev/pytest/issues/8768) to find out if a warnings filter capture anything.
Basic use-case: In big project with a lot of dependencies, the warnings filter list can grow a lot. Currently the only safe way to find out if a filter is still needed, is to remove it and then to run your code. Therefore it would be nice to have a more automatic approach. Suggestion for the warnings module: A new method wich returns all filtered warnings as well as the filter which caused the filtering. The "capturing" could even be placed inside a context generator to avoid a unnecessary collection and a global state. Afterwards it would be possible for tools like pytest to take a look at all applied filters and then to report, which filters were not applied. Additional benefits: A user can e.g. see if a previous general written filter (e.g. without a module) can be more specific. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/FU26XQJKLKLTWFZJE2ZIQO3EZMKJ2CYD/ Code of Conduct: http://python.org/psf/codeofconduct/