summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2021-04-01 23:57:05 (GMT)
committerGitHub <noreply@github.com>2021-04-01 23:57:05 (GMT)
commit036fc7de24cc961d65b60fba266104009feb2797 (patch)
treea89fe7099a06c244cc8c5568773f4dd679e598d5
parentbd4ab8e73906a4f12d5353f567228b7c7497baf7 (diff)
downloadcpython-036fc7de24cc961d65b60fba266104009feb2797.zip
cpython-036fc7de24cc961d65b60fba266104009feb2797.tar.gz
cpython-036fc7de24cc961d65b60fba266104009feb2797.tar.bz2
bpo-43651: Fix EncodingWarning in test_warnings (GH-25126)
-rw-r--r--Lib/test/test_warnings/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index 04f7560..4b1b4e1 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -935,10 +935,10 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
def test_tracemalloc(self):
self.addCleanup(os_helper.unlink, os_helper.TESTFN)
- with open(os_helper.TESTFN, 'w') as fp:
+ with open(os_helper.TESTFN, 'w', encoding="utf-8") as fp:
fp.write(textwrap.dedent("""
def func():
- f = open(__file__)
+ f = open(__file__, "rb")
# Emit ResourceWarning
f = None
@@ -973,7 +973,7 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
File "{filename}", lineno 7
func()
File "{filename}", lineno 3
- f = open(__file__)
+ f = open(__file__, "rb")
''').strip()
self.assertEqual(stderr, expected)