comparison Lib/test/test_httpservers.py @ 60058:40f787b151ac

Merged revisions 79297,79310,79382,79425-79427,79450 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. ........ r79310 | florent.xicluna | 2010-03-22 23:52:11 +0100 (lun, 22 mar 2010) | 2 lines Issue #8205: Remove the "Modules" directory from sys.path when Python is running from the build directory (POSIX only). ........ r79382 | florent.xicluna | 2010-03-24 20:33:25 +0100 (mer, 24 mar 2010) | 2 lines Skip tests which depend on multiprocessing.sharedctypes, if _ctypes is not available. ........ r79425 | florent.xicluna | 2010-03-25 21:32:07 +0100 (jeu, 25 mar 2010) | 2 lines Syntax cleanup `== None` -> `is None` ........ r79426 | florent.xicluna | 2010-03-25 21:33:49 +0100 (jeu, 25 mar 2010) | 2 lines #8207: Fix test_pep277 on OS X ........ r79427 | florent.xicluna | 2010-03-25 21:39:10 +0100 (jeu, 25 mar 2010) | 2 lines Fix test_unittest and test_warnings when running "python -Werror -m test.regrtest" ........ r79450 | florent.xicluna | 2010-03-26 20:32:44 +0100 (ven, 26 mar 2010) | 2 lines Ensure that the failed or unexpected tests are sorted before printing. ........
author Florent Xicluna <florent.xicluna@gmail.com>
date Sun, 28 Mar 2010 00:25:02 +0000
parents 4587e1f74ed8
children 6548c23676a6
comparison
equal deleted inserted replaced
60057:bb2ca1b63321 60058:40f787b151ac
296 BaseTestCase.setUp(self) 296 BaseTestCase.setUp(self)
297 self.parent_dir = tempfile.mkdtemp() 297 self.parent_dir = tempfile.mkdtemp()
298 self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin') 298 self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin')
299 os.mkdir(self.cgi_dir) 299 os.mkdir(self.cgi_dir)
300 300
301 # The shebang line should be pure ASCII: use symlink if possible.
302 # See issue #7668.
303 if hasattr(os, 'symlink'):
304 self.pythonexe = os.path.join(self.parent_dir, 'python')
305 os.symlink(sys.executable, self.pythonexe)
306 else:
307 self.pythonexe = sys.executable
308
301 self.file1_path = os.path.join(self.cgi_dir, 'file1.py') 309 self.file1_path = os.path.join(self.cgi_dir, 'file1.py')
302 with open(self.file1_path, 'w') as file1: 310 with open(self.file1_path, 'w') as file1:
303 file1.write(cgi_file1 % sys.executable) 311 file1.write(cgi_file1 % self.pythonexe)
304 os.chmod(self.file1_path, 0o777) 312 os.chmod(self.file1_path, 0o777)
305 313
306 self.file2_path = os.path.join(self.cgi_dir, 'file2.py') 314 self.file2_path = os.path.join(self.cgi_dir, 'file2.py')
307 with open(self.file2_path, 'w') as file2: 315 with open(self.file2_path, 'w') as file2:
308 file2.write(cgi_file2 % sys.executable) 316 file2.write(cgi_file2 % self.pythonexe)
309 os.chmod(self.file2_path, 0o777) 317 os.chmod(self.file2_path, 0o777)
310 318
311 self.cwd = os.getcwd() 319 self.cwd = os.getcwd()
312 os.chdir(self.parent_dir) 320 os.chdir(self.parent_dir)
313 321
314 def tearDown(self): 322 def tearDown(self):
315 try: 323 try:
316 os.chdir(self.cwd) 324 os.chdir(self.cwd)
325 if self.pythonexe != sys.executable:
326 os.remove(self.pythonexe)
317 os.remove(self.file1_path) 327 os.remove(self.file1_path)
318 os.remove(self.file2_path) 328 os.remove(self.file2_path)
319 os.rmdir(self.cgi_dir) 329 os.rmdir(self.cgi_dir)
320 os.rmdir(self.parent_dir) 330 os.rmdir(self.parent_dir)
321 finally: 331 finally: