https://github.com/python/cpython/commit/9fb32eb83e332a01f082a1beaa9f3c4e35d32949 commit: 9fb32eb83e332a01f082a1beaa9f3c4e35d32949 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: vstinner <[email protected]> date: 2025-10-16T10:57:00Z summary:
[3.13] gh-140170: Fix test_site with -s flag (GH-140179) (#140201) gh-140170: Fix test_site with -s flag (GH-140179) Commit (cherry picked from commit 7ac94fcb1d09796f55faeaf30e349a86a88f7ed6) Co-authored-by: Stan Ulbrych <[email protected]> files: M Lib/test/test_site.py diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index 40b86026b9e677..a128ab3b5569da 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -836,12 +836,15 @@ def get_excepted_output(self, *args): return 10, None def invoke_command_line(self, *args): - args = ["-m", "site", *args] + cmd_args = [] + if sys.flags.no_user_site: + cmd_args.append("-s") + cmd_args.extend(["-m", "site", *args]) with EnvironmentVarGuard() as env: env["PYTHONUTF8"] = "1" env["PYTHONIOENCODING"] = "utf-8" - proc = spawn_python(*args, text=True, env=env, + proc = spawn_python(*cmd_args, text=True, env=env, encoding='utf-8', errors='replace') output = kill_python(proc) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
