New submission from Łukasz Langa <[email protected]>:
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("path.to.module", 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.
----------
assignee: lukasz.langa
components: Tests
messages: 399102
nosy: lukasz.langa
priority: normal
severity: normal
stage: patch review
status: open
title: Add ability to wholesale silence DeprecationWarnings while running the
test suite
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue44852>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com