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?
Asked
Active
Viewed 554 times
1 Answers
2
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.

jns
- 1,250
- 1
- 13
- 29