Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running test_warnings twice fails #74995

Closed
vstinner opened this issue Jun 30, 2017 · 5 comments
Closed

Running test_warnings twice fails #74995

vstinner opened this issue Jun 30, 2017 · 5 comments
Labels
3.7 (EOL) end of life

Comments

@vstinner
Copy link
Member

BPO 30812
Nosy @vstinner
PRs
  • bpo-30812: Fix test_warnings, restore _showwarnmsg #2504
  • [3.6] bpo-30812: Fix test_warnings, restore _showwarnmsg (#2504) #2507
  • 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 = <Date 2017-06-30.11:22:09.392>
    created_at = <Date 2017-06-30.09:43:34.069>
    labels = ['3.7']
    title = 'Running test_warnings twice fails'
    updated_at = <Date 2017-06-30.11:22:09.391>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-06-30.11:22:09.391>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-06-30.11:22:09.392>
    closer = 'vstinner'
    components = []
    creation = <Date 2017-06-30.09:43:34.069>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30812
    keywords = []
    message_count = 5.0
    messages = ['297368', '297369', '297372', '297379', '297382']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['2504', '2507']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue30812'
    versions = ['Python 3.6', 'Python 3.7']

    @vstinner
    Copy link
    Member Author

    Example on Python 3.6:

    haypo@selma$ ./python -m test test_warnings test_warnings
    Run tests sequentially
    0:00:00 load avg: 1.74 [1/2] test_warnings
    0:00:01 load avg: 1.68 [2/2] test_warnings
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:902: UserWarning: foo
    wmod.warn("foo")
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:1000: UserWarning: foo
    wmod.warn("foo")
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:964: UserWarning: This is a warning
    wmod.warn(text)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:986: UserWarning: This is a warning
    wmod.warn(text)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:148: UserWarning: FilterTests.test_always
    self.module.warn(message, UserWarning)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:159: UserWarning: FilterTests.test_always_after_ignore
    self.module.warn(message, UserWarning)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:180: UserWarning: FilterTests.test_default
    self.module.warn(message, UserWarning)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:249: UserWarning: handle normally
    self.module.warn(text)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:135: UserWarning: FilterTests.test_ignore_after_default
    self.module.warn(message, UserWarning)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:195: UserWarning: FilterTests.test_module
    self.module.warn(message, UserWarning)
    f.py:42: UserWarning: b
    __init__.py:42: UserWarning: FilterTests.test_once
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/data/stacklevel.py:9: UserWarning: spam1
    warnings.warn(message, stacklevel=stacklevel)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:354: UserWarning: multi 0
    self.module.warn(text)
    /home/haypo/prog/python/3.6/Lib/test/main.py:9: UserWarning: spam9
    __main__:9: UserWarning: spam11
    __main__:9: UserWarning: spam10
    test.test_warnings.data.stacklevel:9: UserWarning: spam8
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/data/stacklevel.py:9: UserWarning: spam3
    warnings.warn(message, stacklevel=stacklevel)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:415: DeprecationWarning: module-level warning
    import test.test_warnings.data.import_warning
    nonasciié€:1: UserWarning: text
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:365: UserWarning: <class 'Warning'>
    self.module.warn(ob)
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:561: MyWarningClass: good warning category
    self.module.warn('good warning category', MyWarningClass)
    <test>:42: UserWarning: defaultaction test
    test.test_warnings:778: UserWarning: test
    file:42: UserWarning: onceregistry test
    /home/haypo/prog/python/3.6/Lib/test/test_warnings/init.py:741: UserWarning: Warning!
    self.module.warn('Warning!')
    /home/haypo/prog/python/3.6/Lib/unittest/case.py:178: UserWarning: Warning!
    callable_obj(*args, **kwargs)
    test test_warnings failed -- multiple errors occurred; run in verbose mode for details
    test_warnings failed
    1 test OK.

    1 test failed:
    test_warnings

    Total duration: 3 sec
    Tests result: FAILURE

    @vstinner vstinner added the 3.7 (EOL) end of life label Jun 30, 2017
    @vstinner
    Copy link
    Member Author

    I saw this bug on AMD64 Windows8.1 Refleaks 3.6:
    "test test_warnings failed -- multiple errors occurred; run in verbose mode for details"
    http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.6/builds/38/steps/test/logs/stdio

    The goal is to get a successful "./python -m test -R 3:3 -v test_warnings" run.

    @vstinner
    Copy link
    Member Author

    Oh cool, my bisect tool identified the bug!

    haypo@selma$ ./python -m test.bisect -o bisect test_warnings test_warnings
    (...)
    Tests (1):

    • test.test_warnings._WarningsTests.test_showwarnmsg_missing
      (...)
      Bisection completed in 14 iterations and 0:00:14

    So the bug is that test_showwarnmsg_missing() removes the warnings._showwarnmsg attribute, but don't restore it.

    #2504 fixes the issue.

    @vstinner
    Copy link
    Member Author

    New changeset 7eebeb8 by Victor Stinner in branch 'master':
    bpo-30812: Fix test_warnings, restore _showwarnmsg (bpo-2504)
    7eebeb8

    @vstinner
    Copy link
    Member Author

    New changeset d0aac5d by Victor Stinner in branch '3.6':
    bpo-30812: Fix test_warnings, restore _showwarnmsg (bpo-2504) (bpo-2507)
    d0aac5d

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant