summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorPaul Moore <p.f.moore@gmail.com>2022-07-16 09:02:22 (GMT)
committerGitHub <noreply@github.com>2022-07-16 09:02:22 (GMT)
commit407ff6556cc999d692b264466ad8d32304a09bce (patch)
tree8c8f44ea7c6fdcc0465dec1c74b633c52a93dcae /Lib
parentbbb2ab70b6d42c097dc35caa4d816ff7476d6554 (diff)
downloadcpython-407ff6556cc999d692b264466ad8d32304a09bce.zip
cpython-407ff6556cc999d692b264466ad8d32304a09bce.tar.gz
cpython-407ff6556cc999d692b264466ad8d32304a09bce.tar.bz2
gh-94772: Fix off-by-one error in Windows launcher (GH-94779)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_launcher.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_launcher.py b/Lib/test/test_launcher.py
index cd7b944..50a2e8c 100644
--- a/Lib/test/test_launcher.py
+++ b/Lib/test/test_launcher.py
@@ -515,6 +515,30 @@ class TestLauncher(unittest.TestCase, RunPyMixin):
self.assertEqual("3.100-arm64", data["SearchInfo.tag"])
self.assertEqual(f"X.Y-arm64.exe -X fake_arg_for_test -prearg {script} -postarg", data["stdout"].strip())
+ def test_py_shebang_nl(self):
+ with self.py_ini(TEST_PY_COMMANDS):
+ with self.script("#! /usr/bin/env python -prearg\n") as script:
+ data = self.run_py([script, "-postarg"])
+ self.assertEqual("PythonTestSuite", data["SearchInfo.company"])
+ self.assertEqual("3.100", data["SearchInfo.tag"])
+ self.assertEqual(f"X.Y.exe -prearg {script} -postarg", data["stdout"].strip())
+
+ def test_py2_shebang_nl(self):
+ with self.py_ini(TEST_PY_COMMANDS):
+ with self.script("#! /usr/bin/env python2 -prearg\n") as script:
+ data = self.run_py([script, "-postarg"])
+ self.assertEqual("PythonTestSuite", data["SearchInfo.company"])
+ self.assertEqual("3.100-32", data["SearchInfo.tag"])
+ self.assertEqual(f"X.Y-32.exe -prearg {script} -postarg", data["stdout"].strip())
+
+ def test_py3_shebang_nl(self):
+ with self.py_ini(TEST_PY_COMMANDS):
+ with self.script("#! /usr/bin/env python3 -prearg\n") as script:
+ data = self.run_py([script, "-postarg"])
+ self.assertEqual("PythonTestSuite", data["SearchInfo.company"])
+ self.assertEqual("3.100-arm64", data["SearchInfo.tag"])
+ self.assertEqual(f"X.Y-arm64.exe -X fake_arg_for_test -prearg {script} -postarg", data["stdout"].strip())
+
def test_install(self):
data = self.run_py(["-V:3.10"], env={"PYLAUNCHER_ALWAYS_INSTALL": "1"}, expect_returncode=111)
cmd = data["stdout"].strip()