bpo-43651: Fix EncodingWarning in tests. (GH-25655)
* test_httplib
* test_httpservers
* test_logging
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 438c2eb..db41e29 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -2084,9 +2084,9 @@ def test_bytes_body(self):
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())