Skip to content

Commit

Permalink
Merge pull request #99 from theOehrly/fix-89
Browse files Browse the repository at this point in the history
Fix ObjectMember related deprecation/removal
  • Loading branch information
Chilipp authored Oct 21, 2024
2 parents 354e67b + f671136 commit 5ef1b47
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
12 changes: 10 additions & 2 deletions autodocsumm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,16 @@ def get_grouped_documenters(self, all_members=False):

# remove members given by exclude-members
if self.options.exclude_members:
members = [(membername, member) for (membername, member) in members
if membername not in self.options.exclude_members]
try:
members = [
member for member in members
if member.__name__ not in self.options.exclude_members
]
except AttributeError: # Sphinx<3.4.0
members = [
(membername, member) for (membername, member) in members
if membername not in self.options.exclude_members
]

# document non-skipped members
memberdocumenters = []
Expand Down
1 change: 1 addition & 0 deletions tests/test-root/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Example documentation

test_module
test_module_summary_only
test_module_exclude_members
test_class
test_class_order
test_class_summary_only
Expand Down
5 changes: 5 additions & 0 deletions tests/test-root/test_module_exclude_members.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Docs of dummy test without some members
=======================================

.. automodule:: dummy
:autosummary-exclude-members: InheritedTestClass,
11 changes: 11 additions & 0 deletions tests/test_autodocsumm.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,17 @@ def test_automodulesumm_nosignatures(self, app):

assert '()' not in html

def test_automodulesumm_exclude_members(self, app):
"""Test building the autosummary of a module with some members
excluded from the autosummary."""
app.build()

html = get_html(app, 'test_module_exclude_members.html')

assert in_autosummary("TestClass", html)
assert not in_autosummary("InheritedTestClass", html)


def test_empty(self, app):
app.build()

Expand Down

0 comments on commit 5ef1b47

Please sign in to comment.