This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Arfrever, brett.cannon, kbk, r.david.murray, roger.serwy, terry.reedy, vinay.sajip
Date 2013-06-16.22:37:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371422254.98.0.0761387531539.issue18081@psf.upfronthosting.co.za>
In-reply-to
Content
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.'
History
Date User Action Args
2013-06-16 22:37:35terry.reedysetrecipients: + terry.reedy, brett.cannon, kbk, vinay.sajip, roger.serwy, Arfrever, r.david.murray
2013-06-16 22:37:34terry.reedysetmessageid: <1371422254.98.0.0761387531539.issue18081@psf.upfronthosting.co.za>
2013-06-16 22:37:34terry.reedylinkissue18081 messages
2013-06-16 22:37:34terry.reedycreate