Add testcase for pygments

This commit is contained in:
Takeshi KOMIYA 2018-09-02 16:17:02 +09:00
parent 1082806c4a
commit 219f024595

View File

@ -1389,20 +1389,21 @@ def test_html_math_renderer_is_mismatched(make_app, app_params):
assert str(exc) == "Unknown math_renderer 'imgmath' is given."
@pytest.mark.sphinx('html', testroot='roles-download')
def test_html_download_role(app, status, warning):
app.build()
assert (app.outdir / '_downloads' / 'dummy.dat').exists()
@pytest.mark.sphinx('html', testroot='basic')
def test_html_pygments_style_default(app):
style = app.builder.highlighter.formatter_args.get('style')
assert style.__name__ == 'Alabaster'
content = (app.outdir / 'index.html').text()
assert ('<li><a class="reference download internal" download="" '
'href="_downloads/dummy.dat">'
'<code class="xref download docutils literal notranslate">'
'<span class="pre">dummy.dat</span></code></a></li>' in content)
assert ('<li><code class="xref download docutils literal notranslate">'
'<span class="pre">not_found.dat</span></code></li>' in content)
assert ('<li><a class="reference download external" download="" '
'href="http://www.sphinx-doc.org/en/master/_static/sphinxheader.png">'
'<code class="xref download docutils literal notranslate">'
'<span class="pre">Sphinx</span> <span class="pre">logo</span>'
'</code></a></li>' in content)
@pytest.mark.sphinx('html', testroot='basic',
confoverrides={'pygments_style': 'sphinx'})
def test_html_pygments_style_manually(app):
style = app.builder.highlighter.formatter_args.get('style')
assert style.__name__ == 'SphinxStyle'
@pytest.mark.sphinx('html', testroot='basic',
confoverrides={'html_theme': 'classic'})
def test_html_pygments_for_classic_theme(app):
style = app.builder.highlighter.formatter_args.get('style')
assert style.__name__ == 'SphinxStyle'