2015-06-26 07:23:03 -05:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
test_ext_graphviz
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Test sphinx.ext.graphviz extension.
|
|
|
|
|
|
|
|
:copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
|
|
|
|
:license: BSD, see LICENSE for details.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import re
|
2015-07-25 09:43:08 -05:00
|
|
|
|
|
|
|
from util import with_app, SkipTest
|
2015-06-26 07:23:03 -05:00
|
|
|
|
|
|
|
|
|
|
|
@with_app('html', testroot='ext-graphviz')
|
|
|
|
def test_graphviz(app, status, warning):
|
|
|
|
app.builder.build_all()
|
2015-07-25 09:43:08 -05:00
|
|
|
if "dot command 'dot' cannot be run" in warning.getvalue():
|
|
|
|
raise SkipTest('graphviz "dot" is not available')
|
|
|
|
|
|
|
|
content = (app.outdir / 'index.html').text()
|
|
|
|
html = ('<p class="graphviz">\s*<img .*?/>\s*</p>\s*'
|
|
|
|
'<p class="caption"><span class="caption-text">caption of graph</span>')
|
|
|
|
assert re.search(html, content, re.S)
|