Skip to content

Commit fb622af

Browse files
committed
Do not use deprecated Autosummary.warnings
See #24
1 parent edba002 commit fb622af

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

autodocsumm/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,10 @@ def run(self):
495495
for node in dn[::-1]:
496496
others.insert(i, node)
497497
dn = []
498-
return self.warnings + dn + doc_nodes
498+
if sphinx_version < [2, 0]:
499+
return self.warnings + dn + doc_nodes
500+
else:
501+
return dn + doc_nodes
499502

500503
def _insert_after_paragraphs(self, node, insertion):
501504
"""Inserts the given `insertion` node after the paragraphs in `node`

tests/test_autodocsumm.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
import os.path as osp
33
import unittest
44
from sphinx_testing import with_app
5+
import sphinx
6+
7+
8+
from autodocsumm import sphinx_version
59

610

711
sphinx_supp = osp.abspath(osp.join(osp.dirname(__file__), 'sphinx_supp'))
@@ -175,6 +179,18 @@ def test_inherited(self, app, status, warning):
175179
html = get_html(app, '/test_inherited.html')
176180
self.assertIn('<span class="pre">test_method</span>', html)
177181

182+
@with_app(buildername='html', srcdir=sphinx_supp,
183+
copy_srcdir_to_tmpdir=True)
184+
@unittest.skipIf(list(sys.version_info)[:2] <= [2, 7],
185+
"not implemented for python 2.7")
186+
@unittest.skipIf(sphinx_version < [2, 0],
187+
"not a problem for sphinx 2.7")
188+
@unittest.expectedFailure
189+
def test_warnings_depreciation(self, app, status, warning):
190+
with self.assertWarnsRegex(sphinx.deprecation.RemovedInSphinx40Warning,
191+
r'(?s).*Autosummary.warnings'):
192+
app.build()
193+
178194

179195
if __name__ == '__main__':
180196
unittest.main()

0 commit comments

Comments
 (0)