diff options
| author | Inada Naoki <songofacandy@gmail.com> | 2021-04-29 02:34:56 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-29 02:34:56 (GMT) |
| commit | fa51c0c448aca9fe5d4e8bc02e71de528931778b (patch) | |
| tree | 7b4b48eb74450ef91c4c2bf68a7e4c0b9f9c7246 /Lib/test/test_httpservers.py | |
| parent | 8557edbfa8f74514de82feea4c62f5963e4e0aa7 (diff) | |
| download | cpython-fa51c0c448aca9fe5d4e8bc02e71de528931778b.zip cpython-fa51c0c448aca9fe5d4e8bc02e71de528931778b.tar.gz cpython-fa51c0c448aca9fe5d4e8bc02e71de528931778b.tar.bz2 | |
bpo-43651: Fix EncodingWarning in tests. (GH-25655)
* test_httplib
* test_httpservers
* test_logging
Diffstat (limited to 'Lib/test/test_httpservers.py')
| -rw-r--r-- | Lib/test/test_httpservers.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index c3d7c8f..12574a6 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -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) |
