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.20:13:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371413584.17.0.184816287499.issue18081@psf.upfronthosting.co.za>
In-reply-to
Content
I discovered the same thing a different way. Grepping Lib/*.py for
'Warning (from warnings module)' hits
F:\Python\dev\cpython\Lib\idlelib\PyShell.py: 67:
F:\Python\dev\cpython\Lib\idlelib\run.py: 34:
Both monkey-patch warnings, when imported, to show warnings 'the Idle way' ;-). 

I am not sure which test file indirectly imports PyShell, but one must. Idle was written to be run from the command line. It was not written to be imported but not run, as in a test environment, or to be run as part of another script.

Roger, can the monkey patching be put in a function that is only called when Idle runs? Perhaps in PyShell.main and run.main? There is no need to reformat warning sent to the console (if there is one) during import, before Idle starts. Can the monkey-patching be undone when Python exits (in case it is being run from within a script)?

In the meanwhile, I will try using support.import_fresh_module('warnings') in test_logging, or better, saving and restoring warnings in test_idle.

[Although the alteration warnings are red-herrings for this issue, I am sure silencing them, including in tkinter tests, would be a good idea.]
History
Date User Action Args
2013-06-16 20:13:04terry.reedysetrecipients: + terry.reedy, brett.cannon, kbk, vinay.sajip, roger.serwy, Arfrever, r.david.murray
2013-06-16 20:13:04terry.reedysetmessageid: <1371413584.17.0.184816287499.issue18081@psf.upfronthosting.co.za>
2013-06-16 20:13:04terry.reedylinkissue18081 messages
2013-06-16 20:13:03terry.reedycreate