Skip to content

Commit 4f7f83b

Browse files
gh-96076: Change test_launcher to use non-admin location for py.ini (GH-96091)
Patch authored by Eryksun. (cherry picked from commit 216ccac) Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 3ea0beb commit 4f7f83b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Lib/test/test_launcher.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,11 @@ def run_py(self, args, env=None, allow_fail=False, expect_returncode=0, argv=Non
239239
return data
240240

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

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

0 commit comments

Comments
 (0)