Skip to content

Commit

Permalink
Remove pytest warnings (#1515)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
humitos committed Jan 2, 2024
1 parent 2da37d6 commit 17111ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
filterwarnings =
# Ignore external dependencies warning deprecations
# Sphinx
# ignore::sphinx.deprecation.RemovedInSphinx90Warning
6 changes: 3 additions & 3 deletions tests/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

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):
Expand Down Expand Up @@ -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 = (
Expand All @@ -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

0 comments on commit 17111ad

Please sign in to comment.