bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)

* test_asyncio
* test_bz2
* test_math
* test_cmath
* test_cmd_line
* test_cmd_line_script
* test_compile
* test_contextlib
* test_profile
* ctypes/test/test_find
* test_multiprocessing
* test_configparser
* test_csv
* test_dbm_dumb
* test_decimal
* test_difflib
* os.fdopen() calls io.text_encoding() to emit EncodingWarning for right place.
This commit is contained in:
Inada Naoki 2021-04-04 09:01:23 +09:00 committed by GitHub
parent dc6d3e1e4c
commit 35715d1e72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 78 additions and 75 deletions

View file

@ -232,7 +232,7 @@ class DumbDBMTestCase(unittest.TestCase):
self.assertEqual(f.keys(), [])
def test_eval(self):
with open(_fname + '.dir', 'w') as stream:
with open(_fname + '.dir', 'w', encoding="utf-8") as stream:
stream.write("str(print('Hacked!')), 0\n")
with support.captured_stdout() as stdout:
with self.assertRaises(ValueError):