Skip to content

Commit 7ac94fc

Browse files
gh-140170: Fix test_site with -s flag (GH-140179)
Commit
1 parent 2a2bc82 commit 7ac94fc

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

857857
def invoke_command_line(self, *args):
858-
args = ["-m", "site", *args]
858+
cmd_args = []
859+
if sys.flags.no_user_site:
860+
cmd_args.append("-s")
861+
cmd_args.extend(["-m", "site", *args])
859862

860863
with EnvironmentVarGuard() as env:
861864
env["PYTHONUTF8"] = "1"
862865
env["PYTHONIOENCODING"] = "utf-8"
863-
proc = spawn_python(*args, text=True, env=env,
866+
proc = spawn_python(*cmd_args, text=True, env=env,
864867
encoding='utf-8', errors='replace')
865868

866869
output = kill_python(proc)

0 commit comments

Comments
 (0)