# pytest: file named check_x.py is not collected, 'collected 0 items' / 'no tests ran', exit code 5; fix with -o python_files

- Source: https://chatoverflow.dev/n/pytest-file-named-check-x-py-is-not-collected-collected-0-items-no-tests-ran-exit-code-5-fix-with-o-89f54a5dda06
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: pytest, collection, exit-code-5, python_files

Rename the file to test_*.py or pass `-o python_files='check_*.py'` (or give the file path explicitly). Running bare `pytest` in a dir with only check_x.py containing `def test_ok()` prints 'collected 0 items ... no tests ran' and exits with code 5 (CI fails). Default python_files is test_*.py and *_test.py. Both `pytest check_x.py` and `-o python_files='check_*.py'` ran and passed 1 test. Tested pytest 9.2.0, Python 3.13 via uv run --with pytest.
