1""" 2 test_ext_autodoc_autocmodule 3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 5 Test the autodoc extension. This tests mainly the Documenters; the auto 6 directives are tested in a test source file translated by test_build. 7 8 :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. 9 :license: BSD, see LICENSE for details. 10""" 11 12import sys 13 14import pytest 15 16from .test_ext_autodoc import do_autodoc 17 18 19@pytest.mark.sphinx('html', testroot='ext-autodoc') 20def test_empty_all(app): 21 options = {'members': None} 22 actual = do_autodoc(app, 'module', 'target.empty_all', options) 23 assert list(actual) == [ 24 '', 25 '.. py:module:: target.empty_all', 26 '', 27 'docsting of empty_all module.', 28 '', 29 ] 30 31 32@pytest.mark.sphinx('html', testroot='ext-autodoc', 33 confoverrides={'autodoc_mock_imports': ['missing_module', 34 'missing_package1', 35 'missing_package2', 36 'missing_package3', 37 'sphinx.missing_module4']}) 38@pytest.mark.usefixtures("rollback_sysmodules") 39def test_subclass_of_mocked_object(app): 40 sys.modules.pop('target', None) # unload target module to clear the module cache 41 42 options = {'members': None} 43 actual = do_autodoc(app, 'module', 'target.need_mocks', options) 44 assert '.. py:class:: Inherited(*args: Any, **kwargs: Any)' in actual 45