test: Merge test_ext_autodoc.py and test_autodoc.py

This commit is contained in:
Takeshi KOMIYA 2020-05-06 13:46:23 +09:00
parent 8c142fe059
commit 2ca76d2366
2 changed files with 21 additions and 33 deletions

View File

@ -16,6 +16,7 @@ from warnings import catch_warnings
import pytest
from docutils.statemachine import ViewList
from sphinx import addnodes
from sphinx.ext.autodoc import ModuleLevelDocumenter, ALL, Options
from sphinx.ext.autodoc.directive import DocumenterBridge, process_documenter_options
from sphinx.testing.util import SphinxTestApp, Struct # NOQA
@ -1689,3 +1690,23 @@ def test_final(app):
' 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() == ''

View File

@ -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() == ''