mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
test: Merge test_ext_autodoc.py and test_autodoc.py
This commit is contained in:
parent
8c142fe059
commit
2ca76d2366
@ -16,6 +16,7 @@ from warnings import catch_warnings
|
|||||||
import pytest
|
import pytest
|
||||||
from docutils.statemachine import ViewList
|
from docutils.statemachine import ViewList
|
||||||
|
|
||||||
|
from sphinx import addnodes
|
||||||
from sphinx.ext.autodoc import ModuleLevelDocumenter, ALL, Options
|
from sphinx.ext.autodoc import ModuleLevelDocumenter, ALL, Options
|
||||||
from sphinx.ext.autodoc.directive import DocumenterBridge, process_documenter_options
|
from sphinx.ext.autodoc.directive import DocumenterBridge, process_documenter_options
|
||||||
from sphinx.testing.util import SphinxTestApp, Struct # NOQA
|
from sphinx.testing.util import SphinxTestApp, Struct # NOQA
|
||||||
@ -1689,3 +1690,23 @@ def test_final(app):
|
|||||||
' docstring',
|
' docstring',
|
||||||
'',
|
'',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('dummy', testroot='ext-autodoc')
|
||||||
|
def test_autodoc(app, status, warning):
|
||||||
|
app.builder.build_all()
|
||||||
|
|
||||||
|
content = app.env.get_doctree('index')
|
||||||
|
assert isinstance(content[3], addnodes.desc)
|
||||||
|
assert content[3][0].astext() == 'autodoc_dummy_module.test'
|
||||||
|
assert content[3][1].astext() == 'Dummy function using dummy.*'
|
||||||
|
|
||||||
|
# issue sphinx-doc/sphinx#2437
|
||||||
|
assert content[11][-1].astext() == """Dummy class Bar with alias.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
my_name
|
||||||
|
|
||||||
|
alias of bug2437.autodoc_dummy_foo.Foo"""
|
||||||
|
assert warning.getvalue() == ''
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
"""
|
|
||||||
test_autodoc
|
|
||||||
~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Test the autodoc extension.
|
|
||||||
|
|
||||||
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
|
|
||||||
:license: BSD, see LICENSE for details.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from sphinx import addnodes
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('dummy', testroot='ext-autodoc')
|
|
||||||
def test_autodoc(app, status, warning):
|
|
||||||
app.builder.build_all()
|
|
||||||
|
|
||||||
content = app.env.get_doctree('index')
|
|
||||||
assert isinstance(content[3], addnodes.desc)
|
|
||||||
assert content[3][0].astext() == 'autodoc_dummy_module.test'
|
|
||||||
assert content[3][1].astext() == 'Dummy function using dummy.*'
|
|
||||||
|
|
||||||
# issue sphinx-doc/sphinx#2437
|
|
||||||
assert content[11][-1].astext() == """Dummy class Bar with alias.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
my_name
|
|
||||||
|
|
||||||
alias of bug2437.autodoc_dummy_foo.Foo"""
|
|
||||||
assert warning.getvalue() == ''
|
|
Loading…
Reference in New Issue
Block a user