Skip to content

Commit 17111ad

Browse files
authored
Remove pytest warnings (#1515)
* Remove pytest warnings Ignore deprecations on Sphinx 9.0 that comes from readthedocs-sphinx-ext and use `findall()` instead of `.traverse()` as suggested by docutils. * We can't ignore a warning from Sphinx 9.0 We are testing in older versions where this exception is not defined. The deprecation warning we are seeing here is not related to `sphinx_rtd_theme` but with `readthedocs-sphinx-ext` because at: https://github.com/rtfd/readthedocs-sphinx-ext/blob/13edf78bab374f51e314e4994c319fadbab806f2/readthedocs_ext/readthedocs.py#L118-L122 In any case, we will stop using that Sphinx extension at some point.
1 parent 2da37d6 commit 17111ad

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pytest.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[pytest]
2+
filterwarnings =
3+
# Ignore external dependencies warning deprecations
4+
# Sphinx
5+
# ignore::sphinx.deprecation.RemovedInSphinx90Warning

tests/test_builders.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
def test_basic():
2020
for (app, status, warning) in build_all('test-basic'):
21-
assert app.env.get_doctree('index').traverse(addnodes.toctree)
21+
assert app.env.get_doctree('index').findall(addnodes.toctree)
2222
content = open(os.path.join(app.outdir, 'index.html')).read()
2323

2424
if isinstance(app.builder, DirectoryHTMLBuilder):
@@ -66,7 +66,7 @@ def test_basic():
6666
def test_empty():
6767
"""Local TOC is showing, as toctree was empty"""
6868
for (app, status, warning) in build_all('test-empty'):
69-
assert app.env.get_doctree('index').traverse(addnodes.toctree)
69+
assert app.env.get_doctree('index').findall(addnodes.toctree)
7070
content = open(os.path.join(app.outdir, 'index.html')).read()
7171
global_toc = '<div class="toctree-wrapper compound">\n</div>'
7272
local_toc = (
@@ -81,7 +81,7 @@ def test_empty():
8181
def test_missing_toctree():
8282
"""Local TOC is showing, as toctree was missing"""
8383
for (app, status, warning) in build_all('test-missing-toctree'):
84-
assert app.env.get_doctree('index').traverse(addnodes.toctree) == []
84+
assert list(app.env.get_doctree('index').findall(addnodes.toctree)) == []
8585
content = open(os.path.join(app.outdir, 'index.html')).read()
8686
assert '<div class="toctree' not in content
8787
assert '<div class="local-toc">' in content

0 commit comments

Comments
 (0)