[Python-checkins] cpython (merge 3.4 -> 3.5): Restore old distutils logging threshold after running test_log.

serhiy.storchaka python-checkins at python.org
Thu Nov 12 06:28:47 EST 2015


https://hg.python.org/cpython/rev/2c9b5c5b54ae
changeset:   99080:2c9b5c5b54ae
branch:      3.5
parent:      99075:4c05e7c195ac
parent:      99079:515ebfbb4e67
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Nov 12 13:15:56 2015 +0200
summary:
  Restore old distutils logging threshold after running test_log.

files:
  Lib/distutils/tests/test_log.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/distutils/tests/test_log.py b/Lib/distutils/tests/test_log.py
--- a/Lib/distutils/tests/test_log.py
+++ b/Lib/distutils/tests/test_log.py
@@ -14,8 +14,8 @@
         # 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 @@
                 stderr.seek(0)
                 self.assertEqual(stderr.read().rstrip(), "fatal:\\xe9")
         finally:
+            log.set_threshold(old_threshold)
             sys.stdout = old_stdout
             sys.stderr = old_stderr
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list