When running pytest, I would like to ignore warnings from third-party packages. I know how to ignore one specific package (see https://stackoverflow.com/a/53218641/2057762), but how do I ignore all but one?
You need to set two filter rules:
[pytest]
filterwarnings =
ignore
default:::mypackage.*
You can apply multiple filters, so ignore everything and re-allow warnings for your package. The last one has highest precedence. Filter syntax is action:message:category:module:line. Possible actions and more details can be found in here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With