Skip to content

Commit 216ccac

Browse files
authored
gh-96076: Change test_launcher to use non-admin location for py.ini (GH-96091)
Patch authored by Eryksun.
1 parent 18b1782 commit 216ccac

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Lib/test/test_launcher.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,11 @@ def run_py(self, args, env=None, allow_fail=False, expect_returncode=0, argv=Non
238238
return data
239239

240240
def py_ini(self, content):
241-
if not self.py_exe:
242-
self.py_exe = self.find_py()
243-
return PreservePyIni(self.py_exe.with_name("py.ini"), content)
241+
local_appdata = os.environ.get("LOCALAPPDATA")
242+
if not local_appdata:
243+
raise unittest.SkipTest("LOCALAPPDATA environment variable is "
244+
"missing or empty")
245+
return PreservePyIni(Path(local_appdata) / "py.ini", content)
244246

245247
@contextlib.contextmanager
246248
def script(self, content, encoding="utf-8"):

0 commit comments

Comments
 (0)