mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
gh-101467: Correct py.exe handling of prefix matches and cases when only one runtime is installed (GH-101468)
(cherry picked from commit eda60916bc
)
Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
parent
89442e18e1
commit
e98fa7121d
4 changed files with 114 additions and 18 deletions
|
@ -57,7 +57,17 @@ TEST_DATA = {
|
|||
None: sys.prefix,
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"PythonTestSuite1": {
|
||||
"DisplayName": "Python Test Suite Single",
|
||||
"3.100": {
|
||||
"DisplayName": "Single Interpreter",
|
||||
"InstallPath": {
|
||||
None: sys.prefix,
|
||||
"ExecutablePath": sys.executable,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,6 +217,7 @@ class RunPyMixin:
|
|||
**{k.upper(): v for k, v in os.environ.items() if k.upper() not in ignore},
|
||||
"PYLAUNCHER_DEBUG": "1",
|
||||
"PYLAUNCHER_DRYRUN": "1",
|
||||
"PYLAUNCHER_LIMIT_TO_COMPANY": "",
|
||||
**{k.upper(): v for k, v in (env or {}).items()},
|
||||
}
|
||||
if not argv:
|
||||
|
@ -389,23 +400,33 @@ class TestLauncher(unittest.TestCase, RunPyMixin):
|
|||
self.assertEqual(company, data["env.company"])
|
||||
self.assertEqual("3.100", data["env.tag"])
|
||||
|
||||
data = self.run_py([f"-V:3.100-3"])
|
||||
data = self.run_py([f"-V:3.100-32"])
|
||||
self.assertEqual("X.Y-32.exe", data["LaunchCommand"])
|
||||
self.assertEqual(company, data["env.company"])
|
||||
self.assertEqual("3.100-32", data["env.tag"])
|
||||
|
||||
data = self.run_py([f"-V:3.100-a"])
|
||||
data = self.run_py([f"-V:3.100-arm64"])
|
||||
self.assertEqual("X.Y-arm64.exe -X fake_arg_for_test", data["LaunchCommand"])
|
||||
self.assertEqual(company, data["env.company"])
|
||||
self.assertEqual("3.100-arm64", data["env.tag"])
|
||||
|
||||
def test_filter_to_company_and_tag(self):
|
||||
company = "PythonTestSuite"
|
||||
data = self.run_py([f"-V:{company}/3.1"])
|
||||
data = self.run_py([f"-V:{company}/3.1"], expect_returncode=103)
|
||||
|
||||
data = self.run_py([f"-V:{company}/3.100"])
|
||||
self.assertEqual("X.Y.exe", data["LaunchCommand"])
|
||||
self.assertEqual(company, data["env.company"])
|
||||
self.assertEqual("3.100", data["env.tag"])
|
||||
|
||||
def test_filter_with_single_install(self):
|
||||
company = "PythonTestSuite1"
|
||||
data = self.run_py(
|
||||
[f"-V:Nonexistent"],
|
||||
env={"PYLAUNCHER_LIMIT_TO_COMPANY": company},
|
||||
expect_returncode=103,
|
||||
)
|
||||
|
||||
def test_search_major_3(self):
|
||||
try:
|
||||
data = self.run_py(["-3"], allow_fail=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue