diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index c1ca4a7aa..23ba2e733 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -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() == '' diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py deleted file mode 100644 index 69846d3ae..000000000 --- a/tests/test_ext_autodoc.py +++ /dev/null @@ -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() == ''