Add ext.autodoc + ext.doctest test root

This commit is contained in:
Zac-HD 2017-11-16 18:28:30 +11:00
parent c2cd4f6a40
commit 973f2680d6
9 changed files with 47 additions and 2 deletions

View File

@ -34,6 +34,7 @@ Other contributors, listed alphabetically, are:
* Hernan Grecco -- search improvements
* Horst Gutmann -- internationalization support
* Martin Hans -- autodoc improvements
* Zac Hatfield-Dodds -- doctest reporting improvements
* Doug Hellmann -- graphviz improvements
* Tim Hoffmann -- theme improvements
* Timotheus Kampik - JS theme & search enhancements

View File

@ -20,6 +20,7 @@ Bugs fixed
* #4531: autosummary: methods are not treated as attributes
* #4538: autodoc: ``sphinx.ext.autodoc.Options`` has been moved
* #4539: autodoc emits warnings for partialmethods
* #4223: doctest: failing tests reported in wrong file, at wrong line
Testing
--------
@ -190,7 +191,7 @@ Bugs fixed
* #3962: sphinx-apidoc does not recognize implicit namespace packages correctly
* #4094: C++, allow empty template argument lists.
* C++, also hyperlink types in the name of declarations with qualified names.
* C++, do not add index entries for declarations inside concepts.
* C++, do not add index entries for declarations inside concepts.
* C++, support the template disambiguator for dependent names.
* #4314: For PDF 'howto' documents, numbering of code-blocks differs from the
one of figures and tables
@ -284,7 +285,7 @@ Bugs fixed
* #1421: Respect the quiet flag in sphinx-quickstart
* #4281: Race conditions when creating output directory
* #4315: For PDF 'howto' documents, ``latex_toplevel_sectioning='part'`` generates
``\chapter`` commands
``\chapter`` commands
* #4214: Two todolist directives break sphinx-1.6.5
* Fix links to external option docs with intersphinx (refs: #3769)
* #4091: Private members not documented without :undoc-members:

View File

@ -0,0 +1,8 @@
from os import path
import sys
sys.path.insert(0, path.abspath(path.dirname(__file__)))
project = 'test project for doctest + autodoc reporting'
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest']
master_doc = 'index'

View File

@ -0,0 +1,4 @@
"""
>>> 'dir/bar.py:2'
"""

View File

@ -0,0 +1,4 @@
>>> 'dir/inner.rst:1'
.. automodule:: dir.bar
:members:

View File

@ -0,0 +1,5 @@
"""
>>> 'foo.py:3'
"""

View File

@ -0,0 +1,4 @@
.. automodule:: foo
:members:
>>> 'index.rst:4'

View File

@ -55,3 +55,21 @@ def test_is_allowed_version():
def cleanup_call():
global cleanup_called
cleanup_called += 1
@pytest.mark.sphinx('doctest', testroot='ext-doctest-with-autodoc')
def test_reporting_with_autodoc(app, status, warning, capfd):
# Patch builder to get a copy of the output
written = []
app.builder._warn_out = written.append
app.builder.build_all()
lines = '\n'.join(written).split('\n')
failures = [l for l in lines if l.startswith('File')]
expected = [
'File "dir/inner.rst", line 1, in default',
'File "dir/bar.py", line 2, in default',
'File "foo.py", line 3, in default',
'File "index.rst", line 4, in default',
]
for location in expected:
assert location in failures