[issue3781] warnings.catch_warnings fails gracelessly when recording warnings but no warnings are emitted
Nick Coghlan
report at bugs.python.org
Wed Sep 10 17:20:46 CEST 2008
Nick Coghlan <ncoghlan at gmail.com> added the comment:
Cleanup patch now attached. Details of changes:
- warnings.catch_warnings() now has reentry guards (and associated
tests) to prevent silent errors when misused
- added back a test_support.check_warnings() convenience wrapper
(deliberately changing the name to be different from the context manager
in the warnings module). This wrapper is no longer configurable - it is
now used solely for tests that want to record normal warnings and check
the results.
- restored the w.reset() calls that went away in the previous checkin
- unit tests that want to test a different module, or don't want
warnings recorded now consistently use warnings.catch_warnings() directly
- cleanups up to the respective documentation
- cleanups to test_py3kwarn so it is better behaved when other tests are
run before it (the lack of reinitialisation of extension modules still
causes problems though)
- tested with "./python -3 -m test.regrtest -uall -x test_ossaudiodev"
(exclusion is needed because test_ossaudiodev hasn't worked properly on
my machine in a very long time - the audio file playback runs overtime
and I've never found the time to figure out why)
Just needs a review and then should be good to go.
----------
keywords: +needs review -patch
Added file: http://bugs.python.org/file11456/issue3781_catch_warnings_cleanup.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3781>
_______________________________________
More information about the Python-bugs-list
mailing list