GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Problems with the warningregistry() decorator in Lib/unittest/test/test_loader.py · Issue #79133 · python/cpython

Problems with the warningregistry() decorator in Lib/unittest/test/test_loader.py #79133

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Problems with the warningregistry() decorator in Lib/unittest/test/test_loader.py#79133
Copy link
Labels
3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dir

Description

@serhiy-storchaka
serhiy-storchaka
opened on Oct 10, 2018
Issue body actions
BPO 34952
Nosy @warsaw, @rbtcollins, @ezio-melotti, @voidspace, @serhiy-storchaka

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2018-10-10.13:14:12.709>
labels = ['3.8', '3.7', 'tests']
title = 'Problems with the warningregistry() decorator in Lib/unittest/test/test_loader.py'
updated_at = <Date 2018-10-10.13:15:59.662>
user = 'https://github.com/serhiy-storchaka'

bugs.python.org fields:

activity = <Date 2018-10-10.13:15:59.662>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Tests']
creation = <Date 2018-10-10.13:14:12.709>
creator = 'serhiy.storchaka'
dependencies = []
files = []
hgrepos = []
issue_num = 34952
keywords = []
message_count = 2.0
messages = ['327468', '327469']
nosy_count = 5.0
nosy_names = ['barry', 'rbcollins', 'ezio.melotti', 'michael.foord', 'serhiy.storchaka']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue34952'
versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

Activity

  1. serhiy-storchaka commented on Oct 10, 2018

    @serhiy-storchaka
    serhiy-storchaka
    on Oct 10, 2018
    MemberAuthor
    More actions

    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 bpo-27063, but now I am not sure that it works as intended. Tests continue to pass after removing it.

  2. serhiy-storchaka
    added
    3.7 (EOL)end of lifeend of life
    3.8 (EOL)end of lifeend of life
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Oct 10, 2018
  3. serhiy-storchaka commented on Oct 10, 2018

    @serhiy-storchaka
    serhiy-storchaka
    on Oct 10, 2018
    MemberAuthor
    More actions

    The decorator was added in bpo-16662.

  4. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  5. serhiy-storchaka
    added this to Unittest & doctest issueson May 20, 2022
  6. serhiy-storchaka commented on Aug 8, 2026

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 8, 2026
    MemberAuthor
    More actions

    The warningregistry() decorator no longer exists. It was removed in c834c02 (GH-92556) together with the deprecated load_tests aliases whose deprecation warnings it was meant to contain, so both problems are moot.

  7. serhiy-storchaka
    closed this as not plannedon Aug 8, 2026
  8. github-project-automation
    moved this to Done in Unittest & doctest issueson Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dir

    Projects

    • Unittest & doctest issues
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.