diff options
Diffstat (limited to 'tests/test_ext_graphviz.py')
-rw-r--r-- | tests/test_ext_graphviz.py | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/tests/test_ext_graphviz.py b/tests/test_ext_graphviz.py index 7d464343f..e59143d37 100644 --- a/tests/test_ext_graphviz.py +++ b/tests/test_ext_graphviz.py @@ -10,37 +10,14 @@ """ import re -import subprocess -from functools import wraps -from util import with_app, SkipTest - - -def skip_if_graphviz_not_found(fn): - @wraps(fn) - def decorator(app, *args, **kwargs): - found = False - graphviz_dot = getattr(app.config, 'graphviz_dot', '') - try: - if graphviz_dot: - dot = subprocess.Popen([graphviz_dot, '-V'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) # show version - dot.communicate() - found = True - except OSError: # No such file or directory - pass +import pytest - if not found: - raise SkipTest('graphviz "dot" is not available') - - return fn(app, *args, **kwargs) - - return decorator +from util import with_app, SkipTest @with_app('html', testroot='ext-graphviz') -@skip_if_graphviz_not_found +@pytest.mark.usefixtures('if_graphviz_found') def test_graphviz_html(app, status, warning): app.builder.build_all() @@ -61,7 +38,7 @@ def test_graphviz_html(app, status, warning): @with_app('latex', testroot='ext-graphviz') -@skip_if_graphviz_not_found +@pytest.mark.usefixtures('if_graphviz_found') def test_graphviz_latex(app, status, warning): app.builder.build_all() @@ -81,7 +58,7 @@ def test_graphviz_latex(app, status, warning): @with_app('html', testroot='ext-graphviz', confoverrides={'language': 'xx'}) -@skip_if_graphviz_not_found +@pytest.mark.usefixtures('if_graphviz_found') def test_graphviz_i18n(app, status, warning): app.builder.build_all() |