Terry J. Reedy added the comment:
Vinay, please comment on this: on my Win7-64 system, as least, test_logging
seems broken without running test_idle first.
F:\Python\dev\cpython\PCbuild>python_d -m test test_logging
[1/1] test_logging
dummy.py:42: UserWarning: Explicit
Warning -- warnings.filters was modified by test_logging
test test_logging failed -- Traceback (most recent call last):
File "F:\Python\dev\cpython\lib\test\test_logging.py", line 1779, in
test_warnings_no_handlers
self.assertEqual(len(logger.handlers), 1)
AssertionError: 0 != 1
Relevant code:
with warnings.catch_warnings():
logging.captureWarnings(True)
self.addCleanup(logging.captureWarnings, False)
# confirm our assumption: no loggers are set
logger = logging.getLogger("py.warnings")
self.assertEqual(logger.handlers, [])
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42)
self.assertEqual(len(logger.handlers), 1)
self.assertIsInstance(logger.handlers[0], logging.NullHandler)
Since the above lines have not been touched in 2 years, and presumably worked
before, perhaps something changed in warnings.catchwarnings or
logging.capturewarnings so that NullHandler is no longer added.
With import_fresh_module added to the test.support import (line 69) and
warnings imported with "warnings = import_fresh_module('warnings')";
cpython\PCbuild>python_d -m test test_logging
produces the same error as above, so it works to eliminate the effect of Idle
running first, and could be used as a temporary fix.
Side note: on Win7, should I see this?
test_basic (test.test_logging.NTEventLogHandlerTest) ... skipped
'win32evtlog/win32evtlogutil required for this test.'
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18081>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com