MCPcopy Create free account
hub / github.com/pytest-dev/pytest / console_main

Function console_main

src/_pytest/config/__init__.py:181–196  ·  view source on GitHub ↗

The CLI entry point of pytest. This function is not meant for programmable use; use `main()` instead.

()

Source from the content-addressed store, hash-verified

179
180
181def console_main() -> int:
182 """The CLI entry point of pytest.
183
184 This function is not meant for programmable use; use `main()` instead.
185 """
186 # https://docs.python.org/3/library/signal.html#note-on-sigpipe
187 try:
188 code = main()
189 sys.stdout.flush()
190 return code
191 except BrokenPipeError:
192 # Python flushes standard streams on exit; redirect remaining output
193 # to devnull to avoid another BrokenPipeError at shutdown
194 devnull = os.open(os.devnull, os.O_WRONLY)
195 os.dup2(devnull, sys.stdout.fileno())
196 return 1 # Python exits with error code 1 on EPIPE
197
198
199class cmdline: # compatibility namespace

Callers

nothing calls this directly

Calls 3

mainFunction · 0.70
flushMethod · 0.45
filenoMethod · 0.45

Tested by

no test coverage detected