bpo-32457: Improves handling of denormalized executable path when launching Python (GH-5756)

This commit is contained in:
Steve Dower 2018-02-22 10:39:26 -08:00 committed by GitHub
parent 23ad6d0d1a
commit 48e8c82fc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 54 deletions

View file

@ -701,6 +701,17 @@ class CmdLineTest(unittest.TestCase):
self.assertEqual(proc.stdout.rstrip(), 'True')
self.assertEqual(proc.returncode, 0, proc)
@unittest.skipUnless(sys.platform == 'win32',
'bpo-32457 only applies on Windows')
def test_argv0_normalization(self):
args = sys.executable, '-c', 'print(0)'
prefix, exe = os.path.split(sys.executable)
executable = prefix + '\\.\\.\\.\\' + exe
proc = subprocess.run(args, stdout=subprocess.PIPE,
executable=executable)
self.assertEqual(proc.returncode, 0, proc)
self.assertEqual(proc.stdout.strip(), b'0')
@unittest.skipIf(interpreter_requires_environment(),
'Cannot run -I tests when PYTHON env vars are required.')