Debian Codegraph @

testing/web-platform/tests/tools/third_party/pytest/doc/en/reference/exit-codes.rst

raw
1 .. _exit-codes:
2
3 Exit codes
4 ========================================================
5
6 Running ``pytest`` can result in six different exit codes:
7
8 :Exit code 0: All tests were collected and passed successfully
9 :Exit code 1: Tests were collected and run but some of the tests failed
10 :Exit code 2: Test execution was interrupted by the user
11 :Exit code 3: Internal error happened while executing tests
12 :Exit code 4: pytest command line usage error
13 :Exit code 5: No tests were collected
14
15 They are represented by the :class:`pytest.ExitCode` enum. The exit codes being a part of the public API can be imported and accessed directly using:
16
17 .. code-block:: python
18
19 from pytest import ExitCode
20
21 .. note::
22
23 If you would like to customize the exit code in some scenarios, specially when
24 no tests are collected, consider using the
25 `pytest-custom_exit_code <https://github.com/yashtodi94/pytest-custom_exit_code>`__
26 plugin.