Skip to content

Commit 40abbf3

Browse files
committed
docs(AGENTS): Add doctest exceptions for Sphinx extension patterns
Document when doctests are NOT required: - Sphinx/docutils visit_*/depart_* methods (tested via integration) - Sphinx setup() functions (entry points not testable in isolation) - Complex recursive traversal functions (extract helpers instead) This clarifies the doctest policy for docs/_ext/ Sphinx extensions where visitor patterns don't have doctests across docutils, Sphinx, or CPython's ast.NodeVisitor.
1 parent 6d44707 commit 40abbf3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ windows:
156156
3. **Keep doctests simple and focused** on demonstrating usage
157157
4. **Add blank lines between test sections** for improved readability
158158

159+
**Doctest exceptions** (patterns where doctests are not required):
160+
161+
1. **Sphinx/docutils `visit_*`/`depart_*` methods** - tested via integration tests; 0 examples across docutils (851 methods), Sphinx (800+), and CPython's `ast.NodeVisitor`
162+
2. **Sphinx `setup()` functions** - entry points not testable in isolation
163+
3. **Complex recursive traversal functions** - extract helper predicates instead
164+
165+
**Best practice for node processing**: Extract testable helper functions (like `_is_usage_block()`) and doctest those. Keep complex visitor logic in integration tests.
166+
159167
## Documentation Standards
160168

161169
### Code Blocks in Documentation

0 commit comments

Comments
 (0)