Skip to content

Commit bf88329

Browse files
authored
Merge pull request #37 from Chilipp/check-module
Check module
2 parents 58367bc + ea2b274 commit bf88329

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,5 @@ target/
6262

6363
# Example ipython notebook checkpoints
6464
*.ipynb_checkpoints/
65+
66+
.mypy_cache

autodocsumm/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ def get_grouped_documenters(self, all_members=False):
206206
if self.env.app:
207207
e[0].parse_name()
208208
e[0].import_object()
209+
if members_check_module and not e[0].check_module():
210+
continue
209211
user_section = self.env.app.emit_firstresult(
210212
'autodocsumm-grouper', self.objtype, e[0].object_name,
211213
e[0].object, section, self.object)

tests/sphinx_supp/empty.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Empty module just to test if product is imported or not
2+
3+
see https://github.com/Chilipp/autodocsumm/issues/32
4+
"""
5+
from itertools import product

tests/sphinx_supp/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ Example documentation
1515
test_autoclasssumm_no_titles
1616
test_automodulesumm
1717
test_automodulesumm_some_sections
18+
test_empty

tests/sphinx_supp/test_empty.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Test of empty module
2+
====================
3+
4+
see https://github.com/Chilipp/autodocsumm/issues/32
5+
6+
.. automodule:: empty
7+
:members:

tests/test_autodocsumm.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,14 @@ def test_automodulesumm_some_sections(self, app, status, warning):
309309
self.assertIn('<span class="pre">large_data</span>', html)
310310
self.assertIn('<span class="pre">test_func</span>', html)
311311

312+
@with_app(buildername='html', srcdir=sphinx_supp,
313+
copy_srcdir_to_tmpdir=True)
314+
def test_empty(self, app, status, warning):
315+
app.build()
316+
317+
html = get_html(app, '/test_empty.html')
312318

319+
self.assertNotIn('<span class="pre">product</span>', html)
313320

314321

315322
if __name__ == '__main__':

0 commit comments

Comments
 (0)