MCPcopy Index your code
hub / github.com/RustPython/RustPython / run_cli

Method run_cli

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

Source from the content-addressed store, hash-verified

75 PS2 = "... "
76
77 def run_cli(self, *args, commands=()):
78 with (
79 captured_stdin() as stdin,
80 captured_stdout() as stdout,
81 captured_stderr() as stderr,
82 self.assertRaises(SystemExit) as cm
83 ):
84 for cmd in commands:
85 stdin.write(cmd + "\n")
86 stdin.seek(0)
87 cli(args)
88
89 out = stdout.getvalue()
90 err = stderr.getvalue()
91 self.assertEqual(cm.exception.code, 0,
92 f"Unexpected failure: {args=}\n{out}\n{err}")
93 return out, err
94
95 def test_interact(self):
96 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