diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:20:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:20:58 +0000 |
commit | 5bb0bb4be543fd5eca41673696a62ed80d493591 (patch) | |
tree | ad2c464f140e86c7f178a6276d7ea4a93e3e6c92 /tests/test_domains/test_domain_std.py | |
parent | Adding upstream version 7.2.6. (diff) | |
download | sphinx-5bb0bb4be543fd5eca41673696a62ed80d493591.tar.xz sphinx-5bb0bb4be543fd5eca41673696a62ed80d493591.zip |
Adding upstream version 7.3.7.upstream/7.3.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/test_domains/test_domain_std.py (renamed from tests/test_domain_std.py) | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/tests/test_domain_std.py b/tests/test_domains/test_domain_std.py index 6d7ab53..52ecdf5 100644 --- a/tests/test_domain_std.py +++ b/tests/test_domains/test_domain_std.py @@ -5,7 +5,6 @@ from unittest import mock import pytest from docutils import nodes from docutils.nodes import definition, definition_list, definition_list_item, term -from html5lib import HTMLParser from sphinx import addnodes from sphinx.addnodes import ( @@ -20,7 +19,7 @@ from sphinx.addnodes import ( ) from sphinx.domains.std import StandardDomain from sphinx.testing import restructuredtext -from sphinx.testing.util import assert_node +from sphinx.testing.util import assert_node, etree_parse def test_process_doc_handle_figure_caption(): @@ -368,16 +367,18 @@ def test_multiple_cmdoptions(app): @pytest.mark.sphinx(testroot='productionlist') def test_productionlist(app, status, warning): - app.builder.build_all() + app.build(force_all=True) warnings = warning.getvalue().split("\n") assert len(warnings) == 2 assert warnings[-1] == '' assert "Dup2.rst:4: WARNING: duplicate token description of Dup, other instance in Dup1" in warnings[0] - with (app.outdir / 'index.html').open('rb') as f: - etree = HTMLParser(namespaceHTMLElements=False).parse(f) - ul = list(etree.iter('ul'))[1] + etree = etree_parse(app.outdir / 'index.html') + nodes = list(etree.iter('ul')) + assert len(nodes) >= 2 + + ul = nodes[1] cases = [] for li in list(ul): assert len(list(li)) == 1 @@ -493,3 +494,24 @@ def test_labeled_field(app): assert domain.labels['label1'] == ('index', 'label1', 'Foo blah blah blah') assert 'label2' in domain.labels assert domain.labels['label2'] == ('index', 'label2', 'Bar blah blah blah') + + +@pytest.mark.sphinx('html', testroot='manpage_url', + confoverrides={'manpages_url': 'https://example.com/{page}.{section}'}) +def test_html_manpage(app): + app.build(force_all=True) + + content = (app.outdir / 'index.html').read_text(encoding='utf8') + assert ('<em class="manpage">' + '<a class="manpage reference external" href="https://example.com/man.1">man(1)</a>' + '</em>') in content + assert ('<em class="manpage">' + '<a class="manpage reference external" href="https://example.com/ls.1">ls.1</a>' + '</em>') in content + assert ('<em class="manpage">' + '<a class="manpage reference external" href="https://example.com/sphinx.">sphinx</a>' + '</em>') in content + assert ('<em class="manpage">' + '<a class="manpage reference external" href="https://example.com/bsd-mailx/mailx.1">mailx(1)</a>' + '</em>') in content + assert '<em class="manpage">man(1)</em>' in content |