MCPcopy
hub / github.com/pallets/click / Result

Class Result

src/click/testing.py:231–314  ·  view source on GitHub ↗

Holds the captured result of an invoked CLI script. :param runner: The runner that created the result :param stdout_bytes: The standard output as bytes. :param stderr_bytes: The standard error as bytes. :param output_bytes: A mix of ``stdout_bytes`` and ``stderr_bytes``, as the

Source from the content-addressed store, hash-verified

229
230
231class Result:
232 """Holds the captured result of an invoked CLI script.
233
234 :param runner: The runner that created the result
235 :param stdout_bytes: The standard output as bytes.
236 :param stderr_bytes: The standard error as bytes.
237 :param output_bytes: A mix of ``stdout_bytes`` and ``stderr_bytes``, as the
238 user would see it in its terminal.
239 :param return_value: The value returned from the invoked command.
240 :param exit_code: The exit code as integer.
241 :param exception: The exception that happened if one did.
242 :param exc_info: Exception information (exception type, exception instance,
243 traceback type).
244
245 .. versionchanged:: 8.2
246 ``stderr_bytes`` no longer optional, ``output_bytes`` introduced and
247 ``mix_stderr`` has been removed.
248
249 .. versionadded:: 8.0
250 Added ``return_value``.
251 """
252
253 runner: CliRunner
254 stdout_bytes: bytes
255 stderr_bytes: bytes
256 output_bytes: bytes
257 return_value: t.Any
258 exit_code: int
259 exception: BaseException | None
260 exc_info: ExceptionInfo | None
261
262 def __init__(
263 self,
264 runner: CliRunner,
265 stdout_bytes: bytes,
266 stderr_bytes: bytes,
267 output_bytes: bytes,
268 return_value: t.Any,
269 exit_code: int,
270 exception: BaseException | None,
271 exc_info: ExceptionInfo | None = None,
272 ) -> None:
273 self.runner = runner
274 self.stdout_bytes = stdout_bytes
275 self.stderr_bytes = stderr_bytes
276 self.output_bytes = output_bytes
277 self.return_value = return_value
278 self.exit_code = exit_code
279 self.exception = exception
280 self.exc_info = exc_info
281
282 @property
283 def output(self) -> str:
284 """The terminal output as unicode string, as the user would see it.
285
286 .. versionchanged:: 8.2
287 No longer a proxy for ``self.stdout``. Now has its own independent stream
288 that is mixing `<stdout>` and `<stderr>`, in the order they were written.

Callers 1

invokeMethod · 0.85

Calls

no outgoing calls

Tested by 1

invokeMethod · 0.68