Skip to content

Commit

Permalink
Make the tests pass with Sphinx 7.1
Browse files Browse the repository at this point in the history
Update the expected XML files to match Sphinx 7.1 output, and patch
Sphinx < 7.1 output to match our new expectations.
  • Loading branch information
mitya57 authored and Daltz333 committed Sep 7, 2023
1 parent cd11906 commit f60a10e
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions tests/conftest.py
Expand Up @@ -2,6 +2,7 @@
import pytest
from pathlib import Path
from bs4 import BeautifulSoup
import sphinx
from sphinx.testing.path import path

from sphinx_tabs.tabs import FILES
Expand Down Expand Up @@ -123,6 +124,11 @@ def read(app, docname="index", resolve=False, regress=False, replace=None):
text = doctree.pformat() # type: str
for find, rep in (replace or {}).items():
text = text.replace(find, rep)
if sphinx.version_info < (7, 1):
text = text.replace(
'<document source="index.rst">',
"<document source=\"index.rst\" translation_progress=\"{'total': 0, 'translated': 0}\">",
)
file_regression.check(text, extension=extension)

return doctree
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_basic.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<container classes="sphinx-tabs" type="tab-element">
<div aria-label="Tabbed content" classes="closeable" role="tablist">
<button aria-controls="panel-0-0-0" aria-selected="true" classes="sphinx-tabs-tab" ids="tab-0-0-0" name="0-0" role="tab" tabindex="0">
Expand Down
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="False" hidden="False" includefiles="no_tabs1 no_tabs2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False">
<section ids="fruits" names="fruits">
Expand Down
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="False" hidden="False" includefiles="no_tabs1 no_tabs2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False">
<section ids="fruits" names="fruits">
Expand Down
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="False" hidden="False" includefiles="no_tabs1 no_tabs2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False">
<section ids="fruits" names="fruits">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_conditional_assets_index_.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="False" hidden="False" includefiles="no_tabs1 no_tabs2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False">
<section ids="fruits" names="fruits">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_conditional_assets_no_tabs1_.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="False" hidden="False" includefiles="no_tabs1 no_tabs2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False">
<section ids="fruits" names="fruits">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_conditional_assets_no_tabs2_.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="False" hidden="False" includefiles="no_tabs1 no_tabs2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False">
<section ids="fruits" names="fruits">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_custom_lexer.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<container classes="sphinx-tabs" type="tab-element">
<div aria-label="Tabbed content" classes="closeable" role="tablist">
<button aria-controls="panel-0-QllP" aria-selected="true" classes="sphinx-tabs-tab code-tab group-tab" ids="tab-0-QllP" name="QllP" role="tab" tabindex="0">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_disable_closing.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<container classes="sphinx-tabs" type="tab-element">
<div aria-label="Tabbed content" role="tablist">
<button aria-controls="panel-0-0-0" aria-selected="true" classes="sphinx-tabs-tab" ids="tab-0-0-0" name="0-0" role="tab" tabindex="0">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_disable_css_loading.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<container classes="sphinx-tabs" type="tab-element">
<div aria-label="Tabbed content" classes="closeable" role="tablist">
<button aria-controls="panel-0-0-0" aria-selected="true" classes="sphinx-tabs-tab" ids="tab-0-0-0" name="0-0" role="tab" tabindex="0">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_nested_markup.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<section ids="markup-in-tab-titles" names="markup\ in\ tab\ titles">
<title>
Markup in Tab Titles
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_no_tabs.xml
@@ -1,3 +1,3 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<paragraph>
There are no tabs here
2 changes: 1 addition & 1 deletion tests/test_build/test_other_with_assets.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<container classes="sphinx-tabs" type="tab-element">
<div aria-label="Tabbed content" classes="closeable" role="tablist">
<button aria-controls="panel-0-Qysr" aria-selected="true" classes="sphinx-tabs-tab code-tab group-tab" ids="tab-0-Qysr" name="Qysr" role="tab" tabindex="0">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/test_rinohtype_pdf.xml
@@ -1,4 +1,4 @@
<document source="index.rst">
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<section ids="testing-pdf" names="testing\ pdf">
<title>
TESTING PDF
Expand Down

0 comments on commit f60a10e

Please sign in to comment.