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 serhiy.storchaka
Recipients barry, ezio.melotti, michael.foord, rbcollins, serhiy.storchaka
Date 2018-10-10.13:14:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539177252.94.0.788709270274.issue34952@psf.upfronthosting.co.za>
In-reply-to
Content
There are other issues in the warningregistry() decorator in Lib/unittest/test/test_loader.py.

It contains a code:

    missing = []
    saved = getattr(warnings, '__warningregistry__', missing).copy()
    ...
    if saved is missing:

The problem is that the condition `saved is missing` is always false. If __warningregistry__ was absent, saved is `missing.copy()` which is a new empty list. As result, warnings.__warningregistry__ is set to [] after the test if it did not exist before the test.

Other problem is that this decorator works with __warningregistry__ in the warnings module. It is changed only when warnings are emitted by the code of the warnings module. Is it intentional? I don't know any code that emits warnings in the warnings module.

It is hard to understand what was the intention of this decorator. From initial it was not working and cause the decorated tests be silently skipped. This was fixed in issue27063, but now I am not sure that it works as intended. Tests continue to pass after removing it.
History
Date User Action Args
2018-10-10 13:14:13serhiy.storchakasetrecipients: + serhiy.storchaka, barry, rbcollins, ezio.melotti, michael.foord
2018-10-10 13:14:12serhiy.storchakasetmessageid: <1539177252.94.0.788709270274.issue34952@psf.upfronthosting.co.za>
2018-10-10 13:14:12serhiy.storchakalinkissue34952 messages
2018-10-10 13:14:12serhiy.storchakacreate