On Tue, 2009-01-20 at 09:20 -0500, James Laska wrote:
I'm finishing up some work for Chris Lumens to add unittests into
pykickstart. I'm trying to reduce the expected noise of some tests and
would like to capture or suppress any warnings displayed.
Chris directed me to
, which most
likely works. But I'm looking for something a bit more backwards compatible (that
doesn't use the new with: syntax).
The with syntax isn't the biggest backwards compatibility issue there.
But that's a topic for another day.
Any suggestions or experiences to share?
Here's a little chunk of code I used for doctests:
sw = warnings.showwarning
def showwarning(msg, cat, fname, lno, file=None):
sw(msg, cat, fname.split('/')[-1], 0, sys.stdout)
warnings.showwarning = showwarning
Ignacio Vazquez-Abrams <ivazqueznet(a)gmail.com>
PLEASE don't CC me; I'm already subscribed