sphinx_rtd_theme
sphinx_rtd_theme copied to clipboard
test_basic fails with Sphinx-7.3.7
Problem
tests/test_builders.py::test_basic fails with Sphinx 7.3.7 whereas it didn't fail with 7.2.6. From a superficial look it seems like the file part (index.html) is omitted now and only the anchor #document-foo remains, triggering the assert.
Error Logs/Results
==================================================================================== FAILURES =====================================================================================
___________________________________________________________________________________ test_basic ____________________________________________________________________________________
def test_basic():
for (app, status, warning) in build_all('test-basic'):
assert app.env.get_doctree('index').traverse(addnodes.toctree)
content = open(os.path.join(app.outdir, 'index.html')).read()
if isinstance(app.builder, DirectoryHTMLBuilder):
search = (
'<div class="toctree-wrapper compound">\n'
'<ul>\n'
'<li class="toctree-l1">'
'<a class="reference internal" href="foo/">foo</a>'
'<ul>\n'
'<li class="toctree-l2">'
'<a class="reference internal" href="bar/">bar</a></li>\n'
'</ul>\n'
'</li>\n'
'</ul>\n'
'</div>'
)
assert search in content
elif isinstance(app.builder, SingleFileHTMLBuilder):
search = (
'<ul>\n'
'<li class="toctree-l1">'
'<a class="reference internal" href="index.html#document-foo">foo</a>'
'</li>\n'
'</ul>'
)
> assert search in content
E assert '<ul>\n<li class="toctree-l1"><a class="reference internal" href="index.html#document-foo">foo</a></li>\n</ul>' in '<!DOCTYPE html>\n<html class="writer-html5" lang="en" data-content_root="./">\n<head>\n <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />\n\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Python documentation</title>\n <link rel="stylesheet" type="text/css" href="_static/pygments.css" />\n <link rel="stylesheet" type="text/css" href="_static/css/theme.css" />\n <link rel="stylesheet" type="text/css" href="https://assets.readthedocs.org/static/css/badge_only.css" />\n\n \n <!--[if lt IE 9]>\n <script src="_static/js/html5shiv.min.js"></script>\n <![endif]-->\n \n <script src="_static/jquery.js?v=5d32c60e"></script>\n <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>\n <script src="_static/documentation_options.js"></script>\n <script src="_static/doctools.js"></script>\n <script src="_static/sphinx_highlight.js"></script>\n <script async="async" src="https://assets.readthedocs.org/static/javascript/readthedocs-doc-embed.js"></script>\n <script src="_static/js/theme.js"></script>\n <link rel="index" title="Index" href="genindex.html" />\n <link rel="search" title="Search" href="search.html" /> \n\n<!-- RTD Extra Head -->\n\n<link rel="stylesheet" href="https://assets.readthedocs.org/static/css/readthedocs-doc-embed.css" type="text/css" />\n\n<script type="application/json" id="READTHEDOCS_DATA">{"ad_free": "", "api_host": "", "builder": "sphinx", "canonical_url": "", "docroot": "", "features": {"docsearch_disabled": false}, "global_analytics_code": null, "language": "", "page": "index", "programming_language": "", "project": "", "source_suffix": "", "subprojects": {}, "theme": "", "user_analytics_code": null, "version": ""}</script>\n\n<!--\nUsing this variable directly instead of using `JSON.parse` is deprecated.\nThe READTHEDOCS_DATA global variable will be removed in the future.\n-->\n<script type="text/javascript">\nREADTHEDOCS_DATA = JSON.parse(document.getElementById(\'READTHEDOCS_DATA\').innerHTML);\n</script>\n\n<script type="text/javascript" src="https://assets.readthedocs.org/static/javascript/readthedocs-analytics.js" async="async"></script>\n\n<!-- end RTD <extrahead> -->\n</head>\n\n<body class="wy-body-for-nav"> \n <div class="wy-grid-for-nav">\n <nav data-toggle="wy-nav-shift" class="wy-nav-side">\n <div class="wy-side-scroll">\n <div class="wy-side-nav-search" >\n\n \n \n <a href="#" class="icon icon-home">\n Python\n </a>\n </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">\n <ul>\n<li class="toctree-l1"><a class="reference internal" href="#document-foo">foo</a></li>\n</ul>\n\n </div>\n </div>\n </nav>\n\n <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >\n <i data-toggle="wy-nav-top" class="fa fa-bars"></i>\n <a href="#">Python</a>\n </nav>\n\n <div class="wy-nav-content">\n <div class="rst-content">\n <div role="navigation" aria-label="Page navigation">\n <ul class="wy-breadcrumbs">\n <li><a href="#" class="icon icon-home" aria-label="Home"></a></li>\n <li class="breadcrumb-item active">Python documentation</li>\n <li class="wy-breadcrumbs-aside">\n </li>\n </ul>\n <hr/>\n</div>\n <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">\n <div itemprop="articleBody">\n \n <section id="test-basic">\n<h1>test-basic<a class="headerlink" href="#test-basic" title="Link to this heading">\uf0c1</a></h1>\n<div class="toctree-wrapper compound">\n<span id="document-foo"></span><section id="foo">\n<h2>foo<a class="headerlink" href="#foo" title="Link to this heading">\uf0c1</a></h2>\n<div class="toctree-wrapper compound">\n<span id="document-bar"></span><section id="bar">\n<h3>bar<a class="headerlink" href="#bar" title="Link to this heading">\uf0c1</a></h3>\n</section>\n</div>\n</section>\n</div>\n<section id="heading">\n<h2>Heading<a class="headerlink" href="#heading" title="Link to this heading">\uf0c1</a></h2>\n<section id="subheading">\n<h3>Subheading<a class="headerlink" href="#subheading" title="Link to this heading">\uf0c1</a></h3>\n</section>\n</section>\n</section>\n\n\n </div>\n </div>\n <footer>\n\n <hr/>\n\n <div role="contentinfo">\n <p>© Copyright .</p>\n </div>\n\n Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a\n <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>\n provided by <a href="https://readthedocs.org">Read the Docs</a>.\n \n\n</footer>\n </div>\n </div>\n </section>\n </div>\n <script>\n jQuery(function () {\n SphinxRtdTheme.Navigation.enable(true);\n });\n </script> \n\n</body>\n</html>'
tests/test_builders.py:47: AssertionError
Expected Results
Test passes
Environment Info
- Python Version: 3.11.9
- Sphinx Version: 7.3.7
- RTD Theme Version: 2.0.0
Have the same. Additionally there are some pytest warnings
=============================== warnings summary ===============================
tests/test_builders.py: 11 warnings
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:102: RemovedInSphinx90Warning: 'sphinx.builders.html.StandaloneHTMLBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
if inject_css and theme_css not in app.builder.css_files:
tests/test_builders.py: 60 warnings
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:102: RemovedInSphinx90Warning: The str interface for _CascadingStyleSheet objects is deprecated. Use css.filename instead.
if inject_css and theme_css not in app.builder.css_files:
tests/test_builders.py: 11 warnings
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:116: RemovedInSphinx90Warning: 'sphinx.builders.html.StandaloneHTMLBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
hasattr(app.builder, 'script_files'),
tests/test_builders.py: 11 warnings
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:117: RemovedInSphinx90Warning: 'sphinx.builders.html.StandaloneHTMLBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
js_file not in app.builder.script_files,
tests/test_builders.py: 150 warnings
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:117: RemovedInSphinx90Warning: The str interface for _JavaScript objects is deprecated. Use js.filename instead.
js_file not in app.builder.script_files,
tests/test_builders.py::test_basic
tests/test_builders.py::test_basic
/home/tkloczko/rpmbuild/BUILD/sphinx_rtd_theme-2.0.0/tests/test_builders.py:21: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall().
assert app.env.get_doctree('index').traverse(addnodes.toctree)
tests/test_builders.py::test_basic
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:102: RemovedInSphinx90Warning: 'sphinx.builders.html.SingleFileHTMLBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
if inject_css and theme_css not in app.builder.css_files:
tests/test_builders.py::test_basic
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:116: RemovedInSphinx90Warning: 'sphinx.builders.html.SingleFileHTMLBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
hasattr(app.builder, 'script_files'),
tests/test_builders.py::test_basic
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:117: RemovedInSphinx90Warning: 'sphinx.builders.html.SingleFileHTMLBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
js_file not in app.builder.script_files,
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
/home/tkloczko/rpmbuild/BUILD/sphinx_rtd_theme-2.0.0/tests/test_builders.py:69: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall().
assert app.env.get_doctree('index').traverse(addnodes.toctree)
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:102: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
if inject_css and theme_css not in app.builder.css_files:
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:116: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
hasattr(app.builder, 'script_files'),
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:117: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
js_file not in app.builder.script_files,
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:102: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsDirectoryHTMLBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
if inject_css and theme_css not in app.builder.css_files:
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:116: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsDirectoryHTMLBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
hasattr(app.builder, 'script_files'),
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:117: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsDirectoryHTMLBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
js_file not in app.builder.script_files,
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:102: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsSingleFileHTMLBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
if inject_css and theme_css not in app.builder.css_files:
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:116: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsSingleFileHTMLBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
hasattr(app.builder, 'script_files'),
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:117: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsSingleFileHTMLBuilder.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
js_file not in app.builder.script_files,
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:102: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsSingleFileHTMLBuilderLocalMedia.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
if inject_css and theme_css not in app.builder.css_files:
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:116: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsSingleFileHTMLBuilderLocalMedia.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
hasattr(app.builder, 'script_files'),
tests/test_builders.py::test_empty
tests/test_builders.py::test_missing_toctree
/usr/lib/python3.10/site-packages/readthedocs_ext/readthedocs.py:117: RemovedInSphinx90Warning: 'sphinx.builders.html.ReadtheDocsSingleFileHTMLBuilderLocalMedia.script_files' is deprecated. Check CHANGES for Sphinx API modifications.
js_file not in app.builder.script_files,
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
tests/test_builders.py::test_missing_toctree
/home/tkloczko/rpmbuild/BUILD/sphinx_rtd_theme-2.0.0/tests/test_builders.py:84: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall().
assert app.env.get_doctree('index').traverse(addnodes.toctree) == []
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
The issue that emerges in sphinx_rtd_theme comes from a Sphinx' bugfix and is an intended change: https://www.sphinx-doc.org/en/master/changes.html#id87, https://github.com/sphinx-doc/sphinx/pull/11970
Therefore, to make the test pass and the theme to build, the expected output should be changed.