summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_launcher.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-02-01 21:31:21 (GMT)
committerGitHub <noreply@github.com>2023-02-01 21:31:21 (GMT)
commite98fa7121dd80496c60f07bb51101b648fe27cda (patch)
tree8a1708ebd39076fa983cb4a5da381487929ff9e3 /Lib/test/test_launcher.py
parent89442e18e1e17c0eb0eb06e5da489e1cb2d4219d (diff)
downloadcpython-e98fa7121dd80496c60f07bb51101b648fe27cda.zip
cpython-e98fa7121dd80496c60f07bb51101b648fe27cda.tar.gz
cpython-e98fa7121dd80496c60f07bb51101b648fe27cda.tar.bz2
gh-101467: Correct py.exe handling of prefix matches and cases when only one runtime is installed (GH-101468)
(cherry picked from commit eda60916bc88f8af736790ffd52381e8bb83ae83) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Lib/test/test_launcher.py')
-rw-r--r--Lib/test/test_launcher.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/Lib/test/test_launcher.py b/Lib/test/test_launcher.py
index d7d51eb..d0a1f62 100644
--- a/Lib/test/test_launcher.py
+++ b/Lib/test/test_launcher.py
@@ -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)