@@ -25,11 +25,11 @@ def _captured_script(script):
25
25
indented = script .replace ('\n ' , '\n ' )
26
26
wrapped = dedent (f"""
27
27
import contextlib
28
- with open({ w } , 'w') as spipe:
28
+ with open({ w } , 'w', encoding="utf-8" ) as spipe:
29
29
with contextlib.redirect_stdout(spipe):
30
30
{ indented }
31
31
""" )
32
- return wrapped , open (r )
32
+ return wrapped , open (r , encoding = "utf-8" )
33
33
34
34
35
35
def _run_output (interp , request , shared = None ):
@@ -45,7 +45,7 @@ def _running(interp):
45
45
def run ():
46
46
interpreters .run_string (interp , dedent (f"""
47
47
# wait for "signal"
48
- with open({ r } ) as rpipe:
48
+ with open({ r } , encoding="utf-8" ) as rpipe:
49
49
rpipe.read()
50
50
""" ))
51
51
@@ -54,7 +54,7 @@ def run():
54
54
55
55
yield
56
56
57
- with open (w , 'w' ) as spipe :
57
+ with open (w , 'w' , encoding = "utf-8" ) as spipe :
58
58
spipe .write ('done' )
59
59
t .join ()
60
60
@@ -806,7 +806,7 @@ def f():
806
806
@unittest .skipUnless (hasattr (os , 'fork' ), "test needs os.fork()" )
807
807
def test_fork (self ):
808
808
import tempfile
809
- with tempfile .NamedTemporaryFile ('w+' ) as file :
809
+ with tempfile .NamedTemporaryFile ('w+' , encoding = "utf-8" ) as file :
810
810
file .write ('' )
811
811
file .flush ()
812
812
@@ -816,7 +816,7 @@ def test_fork(self):
816
816
try:
817
817
os.fork()
818
818
except RuntimeError:
819
- with open('{ file .name } ', 'w') as out:
819
+ with open('{ file .name } ', 'w', encoding='utf-8' ) as out:
820
820
out.write('{ expected } ')
821
821
""" )
822
822
interpreters .run_string (self .id , script )
0 commit comments