gh-96076: Change test_launcher to use non-admin location for py.ini (GH-96091)

https://github.com/python/cpython/commit/216ccacda193733ef92146c8ac1eb81893b... commit: 216ccacda193733ef92146c8ac1eb81893b4478d branch: main author: Terry Jan Reedy <tjreedy@udel.edu> committer: zooba <steve.dower@microsoft.com> date: 2022-08-22T17:23:27+01:00 summary: gh-96076: Change test_launcher to use non-admin location for py.ini (GH-96091) Patch authored by Eryksun. files: M Lib/test/test_launcher.py diff --git a/Lib/test/test_launcher.py b/Lib/test/test_launcher.py index 835a51e3b6e..9e265901b18 100644 --- a/Lib/test/test_launcher.py +++ b/Lib/test/test_launcher.py @@ -238,9 +238,11 @@ def run_py(self, args, env=None, allow_fail=False, expect_returncode=0, argv=Non return data def py_ini(self, content): - if not self.py_exe: - self.py_exe = self.find_py() - return PreservePyIni(self.py_exe.with_name("py.ini"), content) + local_appdata = os.environ.get("LOCALAPPDATA") + if not local_appdata: + raise unittest.SkipTest("LOCALAPPDATA environment variable is " + "missing or empty") + return PreservePyIni(Path(local_appdata) / "py.ini", content) @contextlib.contextmanager def script(self, content, encoding="utf-8"):
participants (1)
-
zooba