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

@ -541,7 +541,7 @@ class SimpleHTTPServerTestCase(BaseTestCase):
fullpath = os.path.join(self.tempdir, filename)
try:
open(fullpath, 'w').close()
open(fullpath, 'wb').close()
except OSError:
raise unittest.SkipTest('Can not create file %s on current file '
'system' % filename)
@ -646,7 +646,7 @@ class CGIHTTPServerTestCase(BaseTestCase):
self.skipTest("Python executable path is not encodable to utf-8")
self.nocgi_path = os.path.join(self.parent_dir, 'nocgi.py')
with open(self.nocgi_path, 'w') as fp:
with open(self.nocgi_path, 'w', encoding='utf-8') as fp:
fp.write(cgi_file1 % self.pythonexe)
os.chmod(self.nocgi_path, 0o777)