The CLI entry point of pytest. This function is not meant for programmable use; use `main()` instead.
()
| 179 | |
| 180 | |
| 181 | def 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 | |
| 199 | class cmdline: # compatibility namespace |