You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pytest docs/examples --collect-only collects 0 tests after conftest.py refactor #794
Directory-level collection of docs/examples/ is broken — uv run pytest docs/examples/ --collect-only returns 0 items. Specifying individual files still works fine.
Cause
Introduced in d3d6040 (#742). The pytest_collect_file hook in docs/examples/conftest.py was changed to return None for non-skipped files, with the intention that pytest_pycollect_makemodule would handle collection instead.
However, pytest_pycollect_makemodule only fires for files matching the python_files pattern (test_*.py / *_test.py). Example files (e.g. hello_world.py) don't match, so during directory traversal they're silently dropped.
Fix
Restore an explicit collector return in pytest_collect_file for runnable examples. One-liner — return ExampleModule.from_parent(parent, path=file_path) instead of None at line 421.
Reproduction
uv run pytest docs/examples/ --collect-only
# collected 0 items
uv run pytest docs/examples/hello_world.py --collect-only
# collected 1 item ✓
Activity
fix: restore example collection during directory traversal (generativ…
planetf1 commentedon Apr 8, 2026
Hopefully will fix your issue @jakelorocco : thanks for spotting
fix: restore example collection during directory traversal (#794) (#795)
fix: restore example collection during directory traversal (generativ…