diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-09-23 11:10:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-23 11:10:07 (GMT) |
commit | 24b447edf204a674f9e164ea6d553562c21de1a4 (patch) | |
tree | f7ba660fdc86fa61e9a83ee2e7483311fd2f1b7d /Lib/distutils | |
parent | 17b1d5d4e36aa57a9b25a0e694affbd1ee637e45 (diff) | |
download | cpython-24b447edf204a674f9e164ea6d553562c21de1a4.zip cpython-24b447edf204a674f9e164ea6d553562c21de1a4.tar.gz cpython-24b447edf204a674f9e164ea6d553562c21de1a4.tar.bz2 |
Use in-memory streams instead of NamedTemporaryFile. (GH-9508)
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/tests/test_log.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/distutils/tests/test_log.py b/Lib/distutils/tests/test_log.py index 22c2624..75cf900 100644 --- a/Lib/distutils/tests/test_log.py +++ b/Lib/distutils/tests/test_log.py @@ -1,8 +1,8 @@ """Tests for distutils.log""" +import io import sys import unittest -from tempfile import NamedTemporaryFile from test.support import swap_attr, run_unittest from distutils import log @@ -14,9 +14,11 @@ class TestLog(unittest.TestCase): # output as is. for errors in ('strict', 'backslashreplace', 'surrogateescape', 'replace', 'ignore'): - with self.subTest(errors=errors), \ - NamedTemporaryFile("w+", encoding='cp437', errors=errors) as stdout, \ - NamedTemporaryFile("w+", encoding='cp437', errors=errors) as stderr: + with self.subTest(errors=errors): + stdout = io.TextIOWrapper(io.BytesIO(), + encoding='cp437', errors=errors) + stderr = io.TextIOWrapper(io.BytesIO(), + encoding='cp437', errors=errors) old_threshold = log.set_threshold(log.DEBUG) try: with swap_attr(sys, 'stdout', stdout), \ |