[Python-checkins] r66822 - python/trunk/Lib/test/test_atexit.py

Nick Coghlan ncoghlan at gmail.com
Tue Oct 7 12:27:11 CEST 2008


skip.montanaro wrote:
> +    def tearDown(self):
> +        sys.stdout = sys.__stdout__
> +        sys.stderr = sys.__stderr__
> +        atexit._exithandlers = self.save_handlers

That looks wrong to me (even though it was inherited from the existing
test code) - what if the test harness had previously set sys.stdout/err
to something else? Saving and restoring the streams seems like a safer
option than assuming the test harness hasn't changed them.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
            http://www.boredomandlaziness.org


More information about the Python-checkins mailing list