File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Tests for distutils.log"""
22
3+ import io
34import sys
45import unittest
5- from tempfile import NamedTemporaryFile
66from test .support import swap_attr , run_unittest
77
88from distutils import log
@@ -14,9 +14,11 @@ def test_non_ascii(self):
1414 # output as is.
1515 for errors in ('strict' , 'backslashreplace' , 'surrogateescape' ,
1616 'replace' , 'ignore' ):
17- with self .subTest (errors = errors ), \
18- NamedTemporaryFile ("w+" , encoding = 'cp437' , errors = errors ) as stdout , \
19- NamedTemporaryFile ("w+" , encoding = 'cp437' , errors = errors ) as stderr :
17+ with self .subTest (errors = errors ):
18+ stdout = io .TextIOWrapper (io .BytesIO (),
19+ encoding = 'cp437' , errors = errors )
20+ stderr = io .TextIOWrapper (io .BytesIO (),
21+ encoding = 'cp437' , errors = errors )
2022 old_threshold = log .set_threshold (log .DEBUG )
2123 try :
2224 with swap_attr (sys , 'stdout' , stdout ), \
You can’t perform that action at this time.
0 commit comments