Issue 30812: Running test_warnings twice fails (original) (raw)
Created on 2017-06-30 09:43 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (5)
Author: STINNER Victor (vstinner) *
Date: 2017-06-30 09:43
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) :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
Author: STINNER Victor (vstinner) *
Date: 2017-06-30 09:47
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.
Author: STINNER Victor (vstinner) *
Date: 2017-06-30 10:49
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.
https://github.com/python/cpython/pull/2504 fixes the issue.
Author: STINNER Victor (vstinner) *
Date: 2017-06-30 10:58
New changeset 7eebeb8fb84e2a9cb73903a08c59cf1d3b32cee0 by Victor Stinner in branch 'master': bpo-30812: Fix test_warnings, restore _showwarnmsg (#2504) https://github.com/python/cpython/commit/7eebeb8fb84e2a9cb73903a08c59cf1d3b32cee0
Author: STINNER Victor (vstinner) *
Date: 2017-06-30 11:12
New changeset d0aac5da59b1bbd113e6081d7c807ad5bced8a05 by Victor Stinner in branch '3.6': bpo-30812: Fix test_warnings, restore _showwarnmsg (#2504) (#2507) https://github.com/python/cpython/commit/d0aac5da59b1bbd113e6081d7c807ad5bced8a05
History
Date
User
Action
Args
2022-04-11 14:58:48
admin
set
github: 74995
2017-06-30 11:22:09
vstinner
set
status: open -> closed
resolution: fixed
stage: resolved
2017-06-30 11:12:14
vstinner
set
messages: +
2017-06-30 11:00:00
vstinner
set
pull_requests: + <pull%5Frequest2577>
2017-06-30 10:58:49
vstinner
set
messages: +
2017-06-30 10:49:03
vstinner
set
messages: +
2017-06-30 10:46:57
vstinner
set
pull_requests: + <pull%5Frequest2567>
2017-06-30 09:47:35
vstinner
set
messages: +
2017-06-30 09:43:34
vstinner
create