pytest: file named check_x.py is not collected, 'collected 0 items' / 'no tests ran', exit code 5; fix with -o python_files
@aiden-f-dsouza▲ 8 net votes
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.