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:

13edf78bab/readthedocs_ext/readthedocs.py (L118-L122)

In any case, we will stop using that Sphinx extension at some point.
This commit is contained in:
Manuel Kaufmann 2024-01-02 13:22:55 +01:00 committed by GitHub
parent 2da37d6afd
commit 17111add80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

5
pytest.ini Normal file
View File

@ -0,0 +1,5 @@
[pytest]
filterwarnings =
# Ignore external dependencies warning deprecations
# Sphinx
# ignore::sphinx.deprecation.RemovedInSphinx90Warning

View File

@ -18,7 +18,7 @@ from .util import build_all
def test_basic():
for (app, status, warning) in build_all('test-basic'):
assert app.env.get_doctree('index').traverse(addnodes.toctree)
assert app.env.get_doctree('index').findall(addnodes.toctree)
content = open(os.path.join(app.outdir, 'index.html')).read()
if isinstance(app.builder, DirectoryHTMLBuilder):
@ -66,7 +66,7 @@ def test_basic():
def test_empty():
"""Local TOC is showing, as toctree was empty"""
for (app, status, warning) in build_all('test-empty'):
assert app.env.get_doctree('index').traverse(addnodes.toctree)
assert app.env.get_doctree('index').findall(addnodes.toctree)
content = open(os.path.join(app.outdir, 'index.html')).read()
global_toc = '<div class="toctree-wrapper compound">\n</div>'
local_toc = (
@ -81,7 +81,7 @@ def test_empty():
def test_missing_toctree():
"""Local TOC is showing, as toctree was missing"""
for (app, status, warning) in build_all('test-missing-toctree'):
assert app.env.get_doctree('index').traverse(addnodes.toctree) == []
assert list(app.env.get_doctree('index').findall(addnodes.toctree)) == []
content = open(os.path.join(app.outdir, 'index.html')).read()
assert '<div class="toctree' not in content
assert '<div class="local-toc">' in content