Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3218c31

Browse filesBrowse files
author
Victor Stinner
committed
test_httpservers: Fix skip test check, the python executable path have to be
encodable to utf-8, not to the file1 encoding.
1 parent 23d05c1 commit 3218c31
Copy full SHA for 3218c31

File tree

Expand file treeCollapse file tree

1 file changed

+10
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-7
lines changed

‎Lib/test/test_httpservers.py

Copy file name to clipboardExpand all lines: Lib/test/test_httpservers.py
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,18 @@ def setUp(self):
310310
else:
311311
self.pythonexe = sys.executable
312312

313+
try:
314+
# The python executable path is written as the first line of the
315+
# CGI Python script. The encoding cookie cannot be used, and so the
316+
# path should be encodable to the default script encoding (utf-8)
317+
self.pythonexe.encode('utf-8')
318+
except UnicodeEncodeError:
319+
self.tearDown()
320+
raise self.skipTest(
321+
"Python executable path is not encodable to utf-8")
322+
313323
self.file1_path = os.path.join(self.cgi_dir, 'file1.py')
314324
with open(self.file1_path, 'w') as file1:
315-
try:
316-
self.pythonexe.encode(file1.encoding)
317-
except UnicodeEncodeError:
318-
self.tearDown()
319-
raise self.skipTest(
320-
"Python executable path is not encodable to %s"
321-
% file1.encoding)
322325
file1.write(cgi_file1 % self.pythonexe)
323326
os.chmod(self.file1_path, 0o777)
324327

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.