]> granicus.if.org Git - python/commitdiff
Restore old distutils logging threshold after running test_log.
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 12 Nov 2015 11:15:41 +0000 (13:15 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 12 Nov 2015 11:15:41 +0000 (13:15 +0200)
Lib/distutils/tests/test_log.py

index ce66ee51e7c177dfc562c469f3e09d9ee59093c0..0c2ad7a4268d49ab958dff5e312df800f9e8605d 100644 (file)
@@ -14,8 +14,8 @@ class TestLog(unittest.TestCase):
         # error handler)
         old_stdout = sys.stdout
         old_stderr = sys.stderr
+        old_threshold = log.set_threshold(log.DEBUG)
         try:
-            log.set_threshold(log.DEBUG)
             with NamedTemporaryFile(mode="w+", encoding='ascii') as stdout, \
                  NamedTemporaryFile(mode="w+", encoding='ascii') as stderr:
                 sys.stdout = stdout
@@ -27,6 +27,7 @@ class TestLog(unittest.TestCase):
                 stderr.seek(0)
                 self.assertEqual(stderr.read().rstrip(), "fatal:\\xe9")
         finally:
+            log.set_threshold(old_threshold)
             sys.stdout = old_stdout
             sys.stderr = old_stderr