diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-11-09 02:14:34 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-09 02:14:34 +0900 |
commit | 5337e3848cce988d18a048aaa7a258b275d67e6d (patch) | |
tree | e530bce7c41e0a4afffc84f0b7f15f2ee8d924d0 /tests/test_ext_autodoc_events.py | |
parent | a163bbe870dc5bc7f3863ead37cd391be81fb0cc (diff) | |
parent | 896ecc34d7b36f3d31cd38e77bb0849ae8ad41bb (diff) | |
download | sphinx-git-5337e3848cce988d18a048aaa7a258b275d67e6d.tar.gz |
Merge pull request #8125 from tk0miya/8119_control_appearance_of_member_not_in_module.__all__
Close #8119: autodoc: Control visibility of module member not in __all__
Diffstat (limited to 'tests/test_ext_autodoc_events.py')
-rw-r--r-- | tests/test_ext_autodoc_events.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_ext_autodoc_events.py b/tests/test_ext_autodoc_events.py index 7ddc952ab..798f593dc 100644 --- a/tests/test_ext_autodoc_events.py +++ b/tests/test_ext_autodoc_events.py @@ -80,3 +80,28 @@ def test_between_exclude(app): ' third line', '', ] + + +@pytest.mark.sphinx('html', testroot='ext-autodoc') +def test_skip_module_member(app): + def autodoc_skip_member(app, what, name, obj, skip, options): + if name == "Class": + return True # Skip "Class" class in __all__ + elif name == "raises": + return False # Show "raises()" function (not in __all__) + + app.connect('autodoc-skip-member', autodoc_skip_member) + + options = {"members": None} + actual = do_autodoc(app, 'module', 'target', options) + assert list(actual) == [ + '', + '.. py:module:: target', + '', + '', + '.. py:function:: raises(exc, func, *args, **kwds)', + ' :module: target', + '', + ' Raise AssertionError if ``func(*args, **kwds)`` does not raise *exc*.', + '', + ] |