summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_interpreters.py
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2021-04-06 02:18:41 (GMT)
committerGitHub <noreply@github.com>2021-04-06 02:18:41 (GMT)
commitfb78692f2ad5ee4747f13a73943fbf134b637669 (patch)
treebeb9f1abe584a74f281955ead6541cdeeeaa17a8 /Lib/test/test_interpreters.py
parentf84d5a113680c5a6aaaf9130aed7a34d611748ff (diff)
downloadcpython-fb78692f2ad5ee4747f13a73943fbf134b637669.zip
cpython-fb78692f2ad5ee4747f13a73943fbf134b637669.tar.gz
cpython-fb78692f2ad5ee4747f13a73943fbf134b637669.tar.bz2
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25189)
* Fix _sitebuiltins * Fix test_inspect * Fix test_interpreters * Fix test_io * Fix test_iter * Fix test_json * Fix test_linecache * Fix test_lltrace * Fix test_logging * Fix logging
Diffstat (limited to 'Lib/test/test_interpreters.py')
-rw-r--r--Lib/test/test_interpreters.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_interpreters.py b/Lib/test/test_interpreters.py
index 8d44d49..6266aa7 100644
--- a/Lib/test/test_interpreters.py
+++ b/Lib/test/test_interpreters.py
@@ -14,11 +14,11 @@ def _captured_script(script):
indented = script.replace('\n', '\n ')
wrapped = dedent(f"""
import contextlib
- with open({w}, 'w') as spipe:
+ with open({w}, 'w', encoding='utf-8') as spipe:
with contextlib.redirect_stdout(spipe):
{indented}
""")
- return wrapped, open(r)
+ return wrapped, open(r, encoding='utf-8')
def clean_up_interpreters():
@@ -411,7 +411,7 @@ class TestInterpreterRun(TestBase):
def test_fork(self):
interp = interpreters.create()
import tempfile
- with tempfile.NamedTemporaryFile('w+') as file:
+ with tempfile.NamedTemporaryFile('w+', encoding='utf-8') as file:
file.write('')
file.flush()
@@ -421,7 +421,7 @@ class TestInterpreterRun(TestBase):
try:
os.fork()
except RuntimeError:
- with open('{file.name}', 'w') as out:
+ with open('{file.name}', 'w', encoding='utf-8') as out:
out.write('{expected}')
""")
interp.run(script)