Message191298
I would change the reverted test_logging to add "print(logging._warnings_showwarning)" before the failing assertions. If this is bound to the original warnings.showwarning implementation, all should be well. If it points to e.g. idle_showwarning, you would expect to get a failure, as idle_showwarning formats warning messages differently from what warnings.showwarning is originally bound to.
I think the right fix is to take the approach that logging does: have PyShell.py grow a captureWarnings(bool) function which either captures the old values before setting idle_showwarning/idle_formatwarning or restores them, according to the Boolean passed in. The PyShell.captureWarnings(True) could be called from PyShell module-level code if a side-effect free import is unavoidable, but test_idle could call PyShell.captureWarnings(False) to put things back as they were. I would have thought you could avoid side-effects by having the PyShell.captureWarnings(True) called from somewhere in the code path followed from "if __name__ == '__main__'", or from test_idle code.
Re. Your side note - IIRC that skip of the NTEventLogHandler is expected, unless you install some win32 components which aren't shipped with stock Python (Mark Hammond's pywin32 project, available on SourceForge). They are shipped with other Python distributions, e.g. ActivePython. |
|
Date |
User |
Action |
Args |
2013-06-16 23:42:46 | vinay.sajip | set | recipients:
+ vinay.sajip, brett.cannon, terry.reedy, kbk, roger.serwy, Arfrever, r.david.murray |
2013-06-16 23:42:46 | vinay.sajip | set | messageid: <1371426166.52.0.392893939766.issue18081@psf.upfronthosting.co.za> |
2013-06-16 23:42:46 | vinay.sajip | link | issue18081 messages |
2013-06-16 23:42:46 | vinay.sajip | create | |
|