Skip to content

Commit 6cfbb89

Browse files
StanFromIrelandmiss-islington
authored andcommitted
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 f09a6a2 commit 6cfbb89

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
@@ -836,12 +836,15 @@ def get_excepted_output(self, *args):
836836
return 10, None
837837

838838
def invoke_command_line(self, *args):
839-
args = ["-m", "site", *args]
839+
cmd_args = []
840+
if sys.flags.no_user_site:
841+
cmd_args.append("-s")
842+
cmd_args.extend(["-m", "site", *args])
840843

841844
with EnvironmentVarGuard() as env:
842845
env["PYTHONUTF8"] = "1"
843846
env["PYTHONIOENCODING"] = "utf-8"
844-
proc = spawn_python(*args, text=True, env=env,
847+
proc = spawn_python(*cmd_args, text=True, env=env,
845848
encoding='utf-8', errors='replace')
846849

847850
output = kill_python(proc)

0 commit comments

Comments
 (0)