summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-17 20:13:36 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-17 20:13:36 (GMT)
commit3218c31429dfa88c6c4ab0980c1cf7a45bfa423e (patch)
tree43c0bb2d0b8be490e2fba2df848f5ef0281fa04a
parent23d05c1d985752608aa53cb98908e9bb511762ea (diff)
downloadcpython-3218c31429dfa88c6c4ab0980c1cf7a45bfa423e.zip
cpython-3218c31429dfa88c6c4ab0980c1cf7a45bfa423e.tar.gz
cpython-3218c31429dfa88c6c4ab0980c1cf7a45bfa423e.tar.bz2
test_httpservers: Fix skip test check, the python executable path have to be
encodable to utf-8, not to the file1 encoding.
-rw-r--r--Lib/test/test_httpservers.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index 857bb39..1aeee29 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -310,15 +310,18 @@ class CGIHTTPServerTestCase(BaseTestCase):
else:
self.pythonexe = sys.executable
+ try:
+ # The python executable path is written as the first line of the
+ # CGI Python script. The encoding cookie cannot be used, and so the
+ # path should be encodable to the default script encoding (utf-8)
+ self.pythonexe.encode('utf-8')
+ except UnicodeEncodeError:
+ self.tearDown()
+ raise self.skipTest(
+ "Python executable path is not encodable to utf-8")
+
self.file1_path = os.path.join(self.cgi_dir, 'file1.py')
with open(self.file1_path, 'w') as file1:
- try:
- self.pythonexe.encode(file1.encoding)
- except UnicodeEncodeError:
- self.tearDown()
- raise self.skipTest(
- "Python executable path is not encodable to %s"
- % file1.encoding)
file1.write(cgi_file1 % self.pythonexe)
os.chmod(self.file1_path, 0o777)