[Python-checkins] cpython (3.4): 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/515ebfbb4e67
changeset:   99079:515ebfbb4e67
branch:      3.4
parent:      99074:c8841db9433d
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Nov 12 13:15:41 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