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

skip at pobox.com skip at pobox.com
Tue Oct 7 15:55:42 CEST 2008


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

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

Thanks.  I'll take a look at it.  Is there any "best practice" guide for
test cases?  I suspect Lib/test/README is intended to serve this function,
but is mum on this particular topic.

Skip


More information about the Python-checkins mailing list