mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add ext.autodoc + ext.doctest test root
This commit is contained in:
parent
c2cd4f6a40
commit
973f2680d6
1
AUTHORS
1
AUTHORS
@ -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
|
||||
|
1
CHANGES
1
CHANGES
@ -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
|
||||
--------
|
||||
|
8
tests/roots/test-ext-doctest-with-autodoc/conf.py
Normal file
8
tests/roots/test-ext-doctest-with-autodoc/conf.py
Normal 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'
|
4
tests/roots/test-ext-doctest-with-autodoc/dir/bar.py
Normal file
4
tests/roots/test-ext-doctest-with-autodoc/dir/bar.py
Normal file
@ -0,0 +1,4 @@
|
||||
"""
|
||||
>>> 'dir/bar.py:2'
|
||||
|
||||
"""
|
4
tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst
Normal file
4
tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst
Normal file
@ -0,0 +1,4 @@
|
||||
>>> 'dir/inner.rst:1'
|
||||
|
||||
.. automodule:: dir.bar
|
||||
:members:
|
5
tests/roots/test-ext-doctest-with-autodoc/foo.py
Normal file
5
tests/roots/test-ext-doctest-with-autodoc/foo.py
Normal file
@ -0,0 +1,5 @@
|
||||
"""
|
||||
|
||||
>>> 'foo.py:3'
|
||||
|
||||
"""
|
4
tests/roots/test-ext-doctest-with-autodoc/index.rst
Normal file
4
tests/roots/test-ext-doctest-with-autodoc/index.rst
Normal file
@ -0,0 +1,4 @@
|
||||
.. automodule:: foo
|
||||
:members:
|
||||
|
||||
>>> 'index.rst:4'
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user