Skip to content

Commit 5ef1b47

Browse files
authored
Merge pull request #99 from theOehrly/fix-89
Fix ObjectMember related deprecation/removal
2 parents 354e67b + f671136 commit 5ef1b47

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

autodocsumm/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,16 @@ def get_grouped_documenters(self, all_members=False):
220220

221221
# remove members given by exclude-members
222222
if self.options.exclude_members:
223-
members = [(membername, member) for (membername, member) in members
224-
if membername not in self.options.exclude_members]
223+
try:
224+
members = [
225+
member for member in members
226+
if member.__name__ not in self.options.exclude_members
227+
]
228+
except AttributeError: # Sphinx<3.4.0
229+
members = [
230+
(membername, member) for (membername, member) in members
231+
if membername not in self.options.exclude_members
232+
]
225233

226234
# document non-skipped members
227235
memberdocumenters = []

tests/test-root/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Example documentation
55

66
test_module
77
test_module_summary_only
8+
test_module_exclude_members
89
test_class
910
test_class_order
1011
test_class_summary_only
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Docs of dummy test without some members
2+
=======================================
3+
4+
.. automodule:: dummy
5+
:autosummary-exclude-members: InheritedTestClass,

tests/test_autodocsumm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,17 @@ def test_automodulesumm_nosignatures(self, app):
484484

485485
assert '()' not in html
486486

487+
def test_automodulesumm_exclude_members(self, app):
488+
"""Test building the autosummary of a module with some members
489+
excluded from the autosummary."""
490+
app.build()
491+
492+
html = get_html(app, 'test_module_exclude_members.html')
493+
494+
assert in_autosummary("TestClass", html)
495+
assert not in_autosummary("InheritedTestClass", html)
496+
497+
487498
def test_empty(self, app):
488499
app.build()
489500

0 commit comments

Comments
 (0)