[issue44852] Add ability to wholesale silence DeprecationWarnings while running the test suite

Łukasz Langa report at bugs.python.org
Fri Aug 6 17:11:24 EDT 2021


Łukasz Langa <lukasz at langa.pl> added the comment:

Serhiy, if you take a look at the code, `clear_ignored_deprecations()` only clears the filters that were added by `ignore_deprecations_from()`. It doesn't touch other filters. Sure, we can abuse the context manager instead but this looks pretty busy:

   def setUp(self):
       self.w = warnings.catch_warnings()
       self.w.__enter__()
       warnings.filterwarnings(...)

    def tearDown():
        self.w.__exit__(None, None, None)

Making the API symmetrical is a good idea though, I'll look into that tomorrow.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44852>
_______________________________________


More information about the Python-bugs-list mailing list