Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_httpservers.py @ 59953:f84f83963a78 2.6
Merged revisions 79297,79307 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79297 | florent.xicluna | 2010-03-22 18:18:18 +0100 (lun, 22 mar 2010) | 2 lines
#7668: Fix test_httpservers failure when sys.executable contains non-ASCII bytes.
........
r79307 | florent.xicluna | 2010-03-22 23:45:50 +0100 (lun, 22 mar 2010) | 2 lines
#7667: Fix doctest failures with non-ASCII paths.
........
| author | Florent Xicluna <florent.xicluna@gmail.com> |
|---|---|
| date | Tue, 23 Mar 2010 13:30:12 +0000 |
| parents | 3201fab35220 |
| children | c02144b1c98c |
line wrap: on
line diff
--- a/Lib/test/test_httpservers.py Tue Mar 23 13:24:15 2010 +0000 +++ b/Lib/test/test_httpservers.py Tue Mar 23 13:30:12 2010 +0000 @@ -292,14 +292,22 @@ self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin') os.mkdir(self.cgi_dir) + # The shebang line should be pure ASCII: use symlink if possible. + # See issue #7668. + if hasattr(os, 'symlink'): + self.pythonexe = os.path.join(self.parent_dir, 'python') + os.symlink(sys.executable, self.pythonexe) + else: + self.pythonexe = sys.executable + self.file1_path = os.path.join(self.cgi_dir, 'file1.py') with open(self.file1_path, 'w') as file1: - file1.write(cgi_file1 % sys.executable) + file1.write(cgi_file1 % self.pythonexe) os.chmod(self.file1_path, 0777) self.file2_path = os.path.join(self.cgi_dir, 'file2.py') with open(self.file2_path, 'w') as file2: - file2.write(cgi_file2 % sys.executable) + file2.write(cgi_file2 % self.pythonexe) os.chmod(self.file2_path, 0777) self.cwd = os.getcwd() @@ -308,6 +316,8 @@ def tearDown(self): try: os.chdir(self.cwd) + if self.pythonexe != sys.executable: + os.remove(self.pythonexe) os.remove(self.file1_path) os.remove(self.file2_path) os.rmdir(self.cgi_dir)
