mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Restore old distutils logging threshold after running test_log.
This commit is contained in:
parent
d7a4415599
commit
fda7fe0148
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue