# -*- coding: utf-8 -*- """ 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-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import pytest @pytest.mark.sphinx('qthelp', testroot='basic') def test_qthelp_basic(app, status, warning): app.builder.build_all() qhcp = (app.outdir / 'Python.qhcp').text() assert 'Python documentation' in qhcp assert 'qthelp://org.sphinx.python/doc/index.html' in qhcp assert 'qthelp://org.sphinx.python/doc/index.html' in qhcp assert 'Python.qhp' in qhcp assert 'Python.qch' in qhcp assert 'Python.qch' in qhcp @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 'org.sphinx.python' in qhp qhcp = (app.outdir / 'Python.qhcp').text() assert 'qthelp://org.sphinx.python/doc/index.html' in qhcp assert 'qthelp://org.sphinx.python/doc/index.html' in qhcp # give a namespace app.config.qthelp_namespace = 'org.sphinx-doc.sphinx' app.builder.build_all() qhp = (app.outdir / 'Python.qhp').text() assert 'org.sphinxdoc.sphinx' in qhp qhcp = (app.outdir / 'Python.qhcp').text() assert 'qthelp://org.sphinxdoc.sphinx/doc/index.html' in qhcp assert 'qthelp://org.sphinxdoc.sphinx/doc/index.html' 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 '
' in qhp qhcp = (app.outdir / 'Python.qhcp').text() assert 'Python documentation' in qhcp # give a title app.config.html_title = 'Sphinx "full" title' app.config.html_short_title = 'Sphinx "short" title' app.builder.build_all() qhp = (app.outdir / 'Python.qhp').text() assert '
' in qhp qhcp = (app.outdir / 'Python.qhcp').text() assert 'Sphinx <b>"short"</b> title' in qhcp