Skip to content

Commit 9fe724e

Browse files
authored
🧪 Fix tests for latest sphinx (#993)
1 parent 59b5386 commit 9fe724e

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

tests/test_sphinx/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ def read(
7979
# pygments 2.11.0 introduces a whitespace tag
8080
for pygment_whitespace in doc_div.select("pre > span.w"):
8181
pygment_whitespace.replace_with(pygment_whitespace.text)
82+
# something changed in sphinx 8 (or new docutils) to introduce this, although I couldn't find the actual commit,
83+
# but in any case, it's not important for the regression test
84+
for clearer_div in doc_div.findAll("div", {"class": "clearer"}):
85+
clearer_div.decompose()
8286
text = doc_div.prettify()
8387
# changed in sphinx 7.2
8488
text = text.replace('"Link to this', '"Permalink to this')

tests/test_sphinx/test_sphinx_builds.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def test_references_singlehtml(
178178
# changed in sphinx 7.3
179179
'="#document-index': '="index.html#document-index',
180180
'="#document-other': '="index.html#document-other',
181+
# change in sphinx 8
182+
'href="index.html#': 'href="#',
181183
},
182184
)
183185

tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,28 @@ <h3>
2929
</a>
3030
</h3>
3131
<p>
32-
<a class="reference internal" href="index.html#document-other/other2">
32+
<a class="reference internal" href="#document-other/other2">
3333
<span class="doc">
3434
Other 2 Title
3535
</span>
3636
</a>
3737
</p>
3838
<p>
39-
<a class="reference internal" href="index.html#document-other/other2">
39+
<a class="reference internal" href="#document-other/other2">
4040
<span class="doc">
4141
Other 2 Title
4242
</span>
4343
</a>
4444
</p>
4545
<p>
46-
<a class="reference internal" href="index.html#document-other/other2">
46+
<a class="reference internal" href="#document-other/other2">
4747
<span class="std std-doc">
4848
Other 2 Title
4949
</span>
5050
</a>
5151
</p>
5252
<p>
53-
<a class="reference internal" href="index.html#title">
53+
<a class="reference internal" href="#title">
5454
<span class="std std-ref">
5555
Title
5656
</span>
@@ -71,21 +71,21 @@ <h3>
7171
</section>
7272
</div>
7373
<p>
74-
<a class="reference internal" href="index.html#document-other/other">
74+
<a class="reference internal" href="#document-other/other">
7575
<span class="doc">
7676
Other Title
7777
</span>
7878
</a>
7979
</p>
8080
<p>
81-
<a class="reference internal" href="index.html#document-other/other">
81+
<a class="reference internal" href="#document-other/other">
8282
<span class="doc">
8383
Other Title
8484
</span>
8585
</a>
8686
</p>
8787
<p>
88-
<a class="reference internal" href="index.html#document-other/other">
88+
<a class="reference internal" href="#document-other/other">
8989
<span class="std std-doc">
9090
Other Title
9191
</span>
@@ -99,7 +99,7 @@ <h3>
9999
</a>
100100
</p>
101101
<p>
102-
<a class="reference internal" href="index.html#other-title">
102+
<a class="reference internal" href="#other-title">
103103
<span class="std std-ref">
104104
Other Title
105105
</span>

0 commit comments

Comments
 (0)