MCPcopy Index your code
hub / github.com/python/cpython / invoke_command_line

Method invoke_command_line

Lib/test/test_site.py:846–860  ·  view source on GitHub ↗
(self, *args)

Source from the content-addressed store, hash-verified

844 return 10, None
845
846 def invoke_command_line(self, *args):
847 cmd_args = []
848 if sys.flags.no_user_site:
849 cmd_args.append("-s")
850 cmd_args.extend(["-m", "site", *args])
851
852 with EnvironmentVarGuard() as env:
853 env["PYTHONUTF8"] = "1"
854 env["PYTHONIOENCODING"] = "utf-8"
855 proc = spawn_python(*cmd_args, text=True, env=env,
856 encoding='utf-8', errors='replace')
857
858 output = kill_python(proc)
859 return_code = proc.returncode
860 return return_code, os.path.normpath(dedent(output).strip())
861
862 @support.requires_subprocess()
863 def test_no_args(self):

Callers 5

test_no_argsMethod · 0.95
test_unknown_argsMethod · 0.95
test_base_argMethod · 0.95
test_site_argMethod · 0.95
test_both_argsMethod · 0.95

Calls 7

EnvironmentVarGuardClass · 0.90
spawn_pythonFunction · 0.90
kill_pythonFunction · 0.90
dedentFunction · 0.90
appendMethod · 0.45
extendMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected