Kaydet (Commit) 61b9c3ed authored tarafından Florent Xicluna's avatar Florent Xicluna

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.
........
üst 4f5e828d
...@@ -1328,7 +1328,8 @@ class DocTestRunner: ...@@ -1328,7 +1328,8 @@ class DocTestRunner:
m = self.__LINECACHE_FILENAME_RE.match(filename) m = self.__LINECACHE_FILENAME_RE.match(filename)
if m and m.group('name') == self.test.name: if m and m.group('name') == self.test.name:
example = self.test.examples[int(m.group('examplenum'))] example = self.test.examples[int(m.group('examplenum'))]
return example.source.splitlines(True) source = example.source.encode('ascii', 'backslashreplace')
return source.splitlines(True)
else: else:
return self.save_linecache_getlines(filename, module_globals) return self.save_linecache_getlines(filename, module_globals)
......
...@@ -292,14 +292,22 @@ class CGIHTTPServerTestCase(BaseTestCase): ...@@ -292,14 +292,22 @@ class CGIHTTPServerTestCase(BaseTestCase):
self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin') self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin')
os.mkdir(self.cgi_dir) 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') self.file1_path = os.path.join(self.cgi_dir, 'file1.py')
with open(self.file1_path, 'w') as file1: 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) os.chmod(self.file1_path, 0777)
self.file2_path = os.path.join(self.cgi_dir, 'file2.py') self.file2_path = os.path.join(self.cgi_dir, 'file2.py')
with open(self.file2_path, 'w') as file2: 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) os.chmod(self.file2_path, 0777)
self.cwd = os.getcwd() self.cwd = os.getcwd()
...@@ -308,6 +316,8 @@ class CGIHTTPServerTestCase(BaseTestCase): ...@@ -308,6 +316,8 @@ class CGIHTTPServerTestCase(BaseTestCase):
def tearDown(self): def tearDown(self):
try: try:
os.chdir(self.cwd) os.chdir(self.cwd)
if self.pythonexe != sys.executable:
os.remove(self.pythonexe)
os.remove(self.file1_path) os.remove(self.file1_path)
os.remove(self.file2_path) os.remove(self.file2_path)
os.rmdir(self.cgi_dir) os.rmdir(self.cgi_dir)
......
...@@ -62,6 +62,11 @@ Build ...@@ -62,6 +62,11 @@ Build
variable anymore. It also forwards the LDFLAGS settings to the linker variable anymore. It also forwards the LDFLAGS settings to the linker
when building a shared library. when building a shared library.
Tests
-----
- Issue #7667: Fix doctest failures with non-ASCII paths.
What's New in Python 2.6.5? What's New in Python 2.6.5?
=========================== ===========================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment