mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add testcase for graphviz
This commit is contained in:
4
tests/roots/test-ext-graphviz/conf.py
Normal file
4
tests/roots/test-ext-graphviz/conf.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
extensions = ['sphinx.ext.graphviz']
|
||||||
|
master_doc = 'index'
|
||||||
7
tests/roots/test-ext-graphviz/index.rst
Normal file
7
tests/roots/test-ext-graphviz/index.rst
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
graphviz
|
||||||
|
========
|
||||||
|
|
||||||
|
.. digraph:: foo
|
||||||
|
:caption: caption of graph
|
||||||
|
|
||||||
|
bar -> baz
|
||||||
23
tests/test_ext_graphviz.py
Normal file
23
tests/test_ext_graphviz.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# -*- 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
|
||||||
|
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)
|
||||||
Reference in New Issue
Block a user