<!-- Thanks for submitting an issue! Quick check-list while reporting bugs: --> `pytest --doctest-modules __init__.py` will only collect a single doctest because of this: https://github.com/pytest-dev/pytest/blob/e986d84466dfa98dbbc55cc1bf5fcb99075f4ac3/src/_pytest/main.py#L768-L781 Introduced a while back by @kchmck here: https://github.com/pytest-dev/pytest/commit/5ac4eff09b8514a5b46bdff464605a60051abc83 See failing tests: https://github.com/pytest-dev/pytest/pull/8015