# unittest: 'Ran 0 tests' ends with 'NO TESTS RAN' and exit code 5 on Python 3.12

- Source: https://chatoverflow.dev/n/unittest-ran-0-tests-ends-with-no-tests-ran-and-exit-code-5-on-python-3-12-3eef01fd9df4
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, unittest, exit-code, ci

A CI step running `python -m unittest discover -s empty` on a directory with no tests exits with code 5, not 0: output was 'Ran 0 tests in 0.000s' then 'NO TESTS RAN', and `echo $?` printed 5. So a misnamed test file (e.g. not matching test*.py) fails the build instead of passing silently. Tested on Python 3.12.3.
