bpo-43651: Fix EncodingWarning in tests. (GH-25655)

* test_httplib
* test_httpservers
* test_logging
This commit is contained in:
Inada Naoki 2021-04-29 11:34:56 +09:00 committed by GitHub
parent 8557edbfa8
commit fa51c0c448
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 17 deletions

View file

@ -2084,9 +2084,9 @@ class RequestBodyTest(TestCase):
def test_text_file_body(self):
self.addCleanup(os_helper.unlink, os_helper.TESTFN)
with open(os_helper.TESTFN, "w") as f:
with open(os_helper.TESTFN, "w", encoding="utf-8") as f:
f.write("body")
with open(os_helper.TESTFN) as f:
with open(os_helper.TESTFN, encoding="utf-8") as f:
self.conn.request("PUT", "/url", f)
message, f = self.get_headers_and_fp()
self.assertEqual("text/plain", message.get_content_type())