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

Method run_cli

Lib/test/test_sqlite3/test_cli.py:86–102  ·  view source on GitHub ↗
(self, *args, commands=())

Source from the content-addressed store, hash-verified

84 PS2 = "\001\002 ... \001\002"
85
86 def run_cli(self, *args, commands=()):
87 with (
88 captured_stdin() as stdin,
89 captured_stdout() as stdout,
90 captured_stderr() as stderr,
91 self.assertRaises(SystemExit) as cm
92 ):
93 for cmd in commands:
94 stdin.write(cmd + "\n")
95 stdin.seek(0)
96 cli(args)
97
98 out = stdout.getvalue()
99 err = stderr.getvalue()
100 self.assertEqual(cm.exception.code, 0,
101 f"Unexpected failure: {args=}\n{out}\n{err}")
102 return out, err
103
104 def test_interact(self):
105 out, err = self.run_cli()

Calls 9

captured_stdinFunction · 0.90
captured_stdoutFunction · 0.90
captured_stderrFunction · 0.90
cliFunction · 0.85
assertRaisesMethod · 0.45
writeMethod · 0.45
seekMethod · 0.45
getvalueMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected