diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-01-20 00:28:08 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-20 00:28:08 +0900 |
| commit | 6968889206afd2d417e4ccac26f6a9ac1d1cefc6 (patch) | |
| tree | 3a61f9f4dfae912c3f6e4d901a23d7f7a9a564a7 /tests | |
| parent | ff5031c96e90027510ad2d0251972e12da46402c (diff) | |
| parent | 6be9d2a08eb9f990ddffafd2617f9074541a6463 (diff) | |
| download | sphinx-git-6968889206afd2d417e4ccac26f6a9ac1d1cefc6.tar.gz | |
Merge pull request #5968 from tk0miya/separate_qthelp
Separate qthelp to sphinxcontrib package
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_build.py | 2 | ||||
| -rw-r--r-- | tests/test_build_qthelp.py | 117 |
2 files changed, 1 insertions, 118 deletions
diff --git a/tests/test_build.py b/tests/test_build.py index c62b365fc..399530ed6 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -60,7 +60,7 @@ def nonascii_srcdir(request, rootdir, sphinx_test_tempdir): "buildername", [ # note: no 'html' - if it's ok with dirhtml it's ok with html - 'dirhtml', 'singlehtml', 'pickle', 'json', 'text', 'htmlhelp', 'qthelp', + 'dirhtml', 'singlehtml', 'pickle', 'json', 'text', 'htmlhelp', 'applehelp', 'changes', 'xml', 'pseudoxml', 'linkcheck', ], ) diff --git a/tests/test_build_qthelp.py b/tests/test_build_qthelp.py deleted file mode 100644 index 222577db5..000000000 --- a/tests/test_build_qthelp.py +++ /dev/null @@ -1,117 +0,0 @@ -""" - test_build_qthelp - ~~~~~~~~~~~~~~~~~ - - Test the Qt Help builder and check its output. We don't need to - test the HTML itself; that's already handled by - :file:`test_build_html.py`. - - :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import pytest - -from sphinx.testing.util import etree_parse - - -@pytest.mark.sphinx('qthelp', testroot='basic') -def test_qthelp_basic(app, status, warning): - app.builder.build_all() - - qhp = (app.outdir / 'Python.qhp').text() - assert '<customFilter name="Python ">' in qhp - assert '<filterAttribute>Python</filterAttribute>' in qhp - assert '<filterAttribute></filterAttribute>' in qhp - assert '<section title="Python documentation" ref="index.html">' in qhp - assert '<file>genindex.html</file>' in qhp - assert '<file>index.html</file>' in qhp - assert '<file>_static/basic.css</file>' in qhp - - qhcp = (app.outdir / 'Python.qhcp').text() - assert '<title>Python documentation</title>' in qhcp - assert '<homePage>qthelp://org.sphinx.python/doc/index.html</homePage>' in qhcp - assert '<startPage>qthelp://org.sphinx.python/doc/index.html</startPage>' in qhcp - assert '<input>Python.qhp</input>' in qhcp - assert '<output>Python.qch</output>' in qhcp - assert '<file>Python.qch</file>' in qhcp - - -@pytest.mark.sphinx('qthelp', testroot='need-escaped') -def test_qthelp_escaped(app, status, warning): - app.builder.build_all() - - et = etree_parse(app.outdir / 'needbescapedbproject.qhp') - customFilter = et.find('.//customFilter') - assert len(customFilter) == 2 - assert customFilter.attrib == {'name': 'need <b>"escaped"</b> project '} - assert customFilter[0].text == 'needbescapedbproject' - assert customFilter[1].text is None - - toc = et.find('.//toc') - assert len(toc) == 1 - assert toc[0].attrib == {'title': 'need <b>"escaped"</b> project documentation', - 'ref': 'index.html'} - assert len(toc[0]) == 4 - assert toc[0][0].attrib == {'title': '<foo>', 'ref': 'foo.html'} - assert toc[0][0][0].attrib == {'title': 'quux', 'ref': 'quux.html'} - assert toc[0][0][1].attrib == {'title': 'foo "1"', 'ref': 'foo.html#foo-1'} - assert toc[0][0][1][0].attrib == {'title': 'foo.1-1', 'ref': 'foo.html#foo-1-1'} - assert toc[0][0][2].attrib == {'title': 'foo.2', 'ref': 'foo.html#foo-2'} - assert toc[0][1].attrib == {'title': 'bar', 'ref': 'bar.html'} - assert toc[0][2].attrib == {'title': 'http://sphinx-doc.org/', - 'ref': 'http://sphinx-doc.org/'} - assert toc[0][3].attrib == {'title': 'baz', 'ref': 'baz.html'} - - keywords = et.find('.//keywords') - assert len(keywords) == 2 - assert keywords[0].attrib == {'name': '<subsection>', 'ref': 'index.html#index-0'} - assert keywords[1].attrib == {'name': '"subsection"', 'ref': 'index.html#index-0'} - - -@pytest.mark.sphinx('qthelp', testroot='basic') -def test_qthelp_namespace(app, status, warning): - # default namespace - app.builder.build_all() - - qhp = (app.outdir / 'Python.qhp').text() - assert '<namespace>org.sphinx.python</namespace>' in qhp - - qhcp = (app.outdir / 'Python.qhcp').text() - assert '<homePage>qthelp://org.sphinx.python/doc/index.html</homePage>' in qhcp - assert '<startPage>qthelp://org.sphinx.python/doc/index.html</startPage>' in qhcp - - # give a namespace - app.config.qthelp_namespace = 'org.sphinx-doc.sphinx' - app.builder.build_all() - - qhp = (app.outdir / 'Python.qhp').text() - assert '<namespace>org.sphinx-doc.sphinx</namespace>' in qhp - - qhcp = (app.outdir / 'Python.qhcp').text() - assert '<homePage>qthelp://org.sphinx-doc.sphinx/doc/index.html</homePage>' in qhcp - assert '<startPage>qthelp://org.sphinx-doc.sphinx/doc/index.html</startPage>' in qhcp - - -@pytest.mark.sphinx('qthelp', testroot='basic') -def test_qthelp_title(app, status, warning): - # default title - app.builder.build_all() - - qhp = (app.outdir / 'Python.qhp').text() - assert '<section title="Python documentation" ref="index.html">' in qhp - - qhcp = (app.outdir / 'Python.qhcp').text() - assert '<title>Python documentation</title>' in qhcp - - # give a title - app.config.html_title = 'Sphinx <b>"full"</b> title' - app.config.html_short_title = 'Sphinx <b>"short"</b> title' - app.builder.build_all() - - qhp = (app.outdir / 'Python.qhp').text() - assert ('<section title="Sphinx <b>"full"</b> title" ref="index.html">' - in qhp) - - qhcp = (app.outdir / 'Python.qhcp').text() - assert '<title>Sphinx <b>"short"</b> title</title>' in qhcp |
