Index: Lib/test/test_win_symlinked_executable.py =================================================================== --- Lib/test/test_win_symlinked_executable.py (revision 0) +++ Lib/test/test_win_symlinked_executable.py (revision 0) @@ -0,0 +1,41 @@ +import sys +import os +import unittest +import subprocess + +from test import support + +class TheTest(unittest.TestCase): + # todo: skip unless Windows Vista or later and not cygwin + def test_exec_from_symlink(self): # issue8342 + # create link + link = os.path.abspath(support.TESTFN) + real = os.path.realpath(sys.executable) + cmd = ['cmd', '/c', 'mklink', link, real] + self.assertEqual(0, subprocess.Popen(cmd).wait(), + "Could not create symlink",) + + try: + + # first demonstrate that this works if the DLL is in the path + cmd = [link, '-c', "pass"] + env = dict(os.environ) + env['PATH'] = env['PATH']+';'+os.path.dirname(real) + self.assertEqual(0, subprocess.Popen(cmd,env=env).wait(), + "Failed test with DLL in path",) + + # now run python from the link + self.assertEqual(0, subprocess.Popen(cmd).wait(), + "Failed test without DLL in path",) + finally: + os.remove(link) + + + +def test_main(): + support.run_unittest( + TheTest + ) + +if __name__ == '__main__': + test_main() Property changes on: Lib\test\test_win_symlinked_executable.py ___________________________________________________________________ Added: svn:keywords + Id Rev Author Date