mirror of https://github.com/python/cpython
bpo-43651: Fix EncodingWarning in test_warnings (GH-25126)
This commit is contained in:
parent
bd4ab8e739
commit
036fc7de24
|
@ -935,10 +935,10 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
|
||||||
def test_tracemalloc(self):
|
def test_tracemalloc(self):
|
||||||
self.addCleanup(os_helper.unlink, os_helper.TESTFN)
|
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("""
|
fp.write(textwrap.dedent("""
|
||||||
def func():
|
def func():
|
||||||
f = open(__file__)
|
f = open(__file__, "rb")
|
||||||
# Emit ResourceWarning
|
# Emit ResourceWarning
|
||||||
f = None
|
f = None
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
|
||||||
File "{filename}", lineno 7
|
File "{filename}", lineno 7
|
||||||
func()
|
func()
|
||||||
File "{filename}", lineno 3
|
File "{filename}", lineno 3
|
||||||
f = open(__file__)
|
f = open(__file__, "rb")
|
||||||
''').strip()
|
''').strip()
|
||||||
self.assertEqual(stderr, expected)
|
self.assertEqual(stderr, expected)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue