mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-43651: Fix EncodingWarning in tests. (GH-25655)
* test_httplib * test_httpservers * test_logging
This commit is contained in:
parent
8557edbfa8
commit
fa51c0c448
3 changed files with 21 additions and 17 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue