Skip to content

Commit 0eb5b6f

Browse files
committed
pythongh-96076: Fix test_launcher failures
Test is new in 3.11. It failed with an all-user (admin) install on Windows when run by non-admin user. Fix tested in same conditions as failure. Patch authored by Eryksun.
1 parent 214eb2c commit 0eb5b6f

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)