File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
"""Tests for distutils.log"""
2
2
3
+ import io
3
4
import sys
4
5
import unittest
5
- from tempfile import NamedTemporaryFile
6
6
from test .support import swap_attr , run_unittest
7
7
8
8
from distutils import log
@@ -14,9 +14,11 @@ def test_non_ascii(self):
14
14
# output as is.
15
15
for errors in ('strict' , 'backslashreplace' , 'surrogateescape' ,
16
16
'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 )
20
22
old_threshold = log .set_threshold (log .DEBUG )
21
23
try :
22
24
with swap_attr (sys , 'stdout' , stdout ), \
You can’t perform that action at this time.
0 commit comments