mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Warn if doctest blocks don't contain code.
This commit is contained in:
parent
44b0929669
commit
7debd67c23
2
CHANGES
2
CHANGES
@ -1,6 +1,8 @@
|
||||
Release 0.5.1 (in development)
|
||||
==============================
|
||||
|
||||
* Warn if a doctest extension block doesn't contain any code.
|
||||
|
||||
* Fix the handling of ``:param:`` and ``:type:`` doc fields when
|
||||
they contain markup (especially cross-referencing roles).
|
||||
|
||||
|
@ -229,8 +229,12 @@ Doctest summary
|
||||
return isinstance(node, (nodes.literal_block, nodes.comment)) \
|
||||
and node.has_key('testnodetype')
|
||||
for node in doctree.traverse(condition):
|
||||
code = TestCode(node.has_key('test') and node['test'] or node.astext(),
|
||||
type=node.get('testnodetype', 'doctest'),
|
||||
source = node.has_key('test') and node['test'] or node.astext()
|
||||
if not source:
|
||||
self.warn('no code/output in %s block at %s:%s' %
|
||||
(node.get('testnodetype', 'doctest'),
|
||||
self.env.doc2path(docname), node.line))
|
||||
code = TestCode(source, type=node.get('testnodetype', 'doctest'),
|
||||
lineno=node.line, options=node.get('options'))
|
||||
node_groups = node.get('groups', ['default'])
|
||||
if '*' in node_groups:
|
||||
|
Loading…
Reference in New Issue
Block a user