This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lukasz.langa
Recipients lukasz.langa
Date 2021-08-06.16:34:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Sometimes we have the following problem:
- there are way too many deprecations raised from a given library to silence them one by one;
- the deprecations are different between maintenance branches and we don't want to make tests between the branches hopelessly conflicting.

In particular, there is such a case right now with asyncio in 3.9 vs. later branches. 3.8 deprecated the loop= argument in a bunch of functions but due to poor warning placement, most of them were silent. This is being fixed in BPO-44815 which would go out to users in 3.9.7 but that created 220 new warnings when running test_asyncion in regression tests. Fixing them one by one would be both tedious, and would make the 3.9 branch forever conflicting with newer branches in many asyncio test files. In 3.11 there's a new round of deprecations raised in test_asyncio, making the branches different. Moreover, those warnings are typically silenced by `assertWarns` context managers which should only be used when actually testing the warnings, *not* to silence irrelevant warnings.

So, what the PR does is it introduces:

- `support.ignore_deprecations_from("", like=".*msg regex.*")`, and
- `support.clear_ignored_deprecations()`

The former adds a new filter to warnings, the message regex is mandatory. The latter removes only the filters that were added by the former, leaving all other filters alone.

Example usage is in `test_support`, and later, should this be merged, will be in asyncio tests on the 3.9 branch.
Date User Action Args
2021-08-06 16:34:02lukasz.langasetrecipients: + lukasz.langa
2021-08-06 16:34:02lukasz.langasetmessageid: <>
2021-08-06 16:34:02lukasz.langalinkissue44852 messages
2021-08-06 16:34:02lukasz.langacreate