Skip to content

Commit e69fb20

Browse files
[3.14] gh-140170: Fix test_site with -s flag (GH-140179) (#140198)
gh-140170: Fix test_site with -s flag (GH-140179) Commit (cherry picked from commit 7ac94fc) Co-authored-by: Stan Ulbrych <[email protected]>
1 parent 231552c commit e69fb20

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_site.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,12 +846,15 @@ def get_excepted_output(self, *args):
846846
return 10, None
847847

848848
def invoke_command_line(self, *args):
849-
args = ["-m", "site", *args]
849+
cmd_args = []
850+
if sys.flags.no_user_site:
851+
cmd_args.append("-s")
852+
cmd_args.extend(["-m", "site", *args])
850853

851854
with EnvironmentVarGuard() as env:
852855
env["PYTHONUTF8"] = "1"
853856
env["PYTHONIOENCODING"] = "utf-8"
854-
proc = spawn_python(*args, text=True, env=env,
857+
proc = spawn_python(*cmd_args, text=True, env=env,
855858
encoding='utf-8', errors='replace')
856859

857860
output = kill_python(proc)

0 commit comments

Comments
 (0)