]> granicus.if.org Git - python/commitdiff
Correctly restore sys.stdout in test_descr
authorNick Coghlan <ncoghlan@gmail.com>
Sat, 17 Oct 2009 06:33:05 +0000 (06:33 +0000)
committerNick Coghlan <ncoghlan@gmail.com>
Sat, 17 Oct 2009 06:33:05 +0000 (06:33 +0000)
Lib/test/test_descr.py

index 00f19ce17bb70a6b32a1094df53e350364a626da..0b21f57ce81a7441ea9365290e24ee9a4e4458d7 100644 (file)
@@ -4311,6 +4311,7 @@ order (MRO) for bases """
     def test_file_fault(self):
         # Testing sys.stdout is changed in getattr...
         import sys
+        test_stdout = sys.stdout
         class StdoutGuard:
             def __getattr__(self, attr):
                 sys.stdout = sys.__stdout__
@@ -4320,6 +4321,8 @@ order (MRO) for bases """
             print "Oops!"
         except RuntimeError:
             pass
+        finally:
+            sys.stdout = test_stdout
 
     def test_vicious_descriptor_nonsense(self):
         # Testing vicious_descriptor_nonsense...