MCPcopy
hub / github.com/pytest-dev/pytest / _console_main

Function _console_main

src/_pytest/config/__init__.py:246–261  ·  view source on GitHub ↗

The CLI entry point of pytest (internal). This is the real implementation used by entry points and ``__main__.py``.

()

Source from the content-addressed store, hash-verified

244
245
246def _console_main() -> int:
247 """The CLI entry point of pytest (internal).
248
249 This is the real implementation used by entry points and ``__main__.py``.
250 """
251 # https://docs.python.org/3/library/signal.html#note-on-sigpipe
252 try:
253 code = _main(prog=_get_prog_name(sys.argv))
254 sys.stdout.flush()
255 return code
256 except BrokenPipeError:
257 # Python flushes standard streams on exit; redirect remaining output
258 # to devnull to avoid another BrokenPipeError at shutdown
259 devnull = os.open(os.devnull, os.O_WRONLY)
260 os.dup2(devnull, sys.stdout.fileno())
261 return 1 # Python exits with error code 1 on EPIPE
262
263
264def console_main() -> int:

Callers 2

__main__.pyFile · 0.90
console_mainFunction · 0.85

Calls 5

_get_prog_nameFunction · 0.85
openMethod · 0.80
_mainFunction · 0.70
flushMethod · 0.45
filenoMethod · 0.45

Tested by

no test coverage detected