summaryrefslogtreecommitdiff
path: root/tests/test_ext_graphviz.py
blob: 0f3d95674fd7cc21461d0b971c946b5dd6fe004f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
"""
    test_ext_graphviz
    ~~~~~~~~~~~~~~~~~

    Test sphinx.ext.graphviz extension.

    :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import re
from util import with_app


@with_app('html', testroot='ext-graphviz')
def test_graphviz(app, status, warning):
    app.builder.build_all()
    if "dot command 'dot' cannot be run" not in warning.getvalue():
        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)