diff options
author | shimizukawa <shimizukawa@gmail.com> | 2017-01-03 22:24:00 +0900 |
---|---|---|
committer | shimizukawa <shimizukawa@gmail.com> | 2017-01-04 00:59:30 +0900 |
commit | 5b7d237db380a75c27137fb37f0396f4a3dc3ecd (patch) | |
tree | f309a2fd9356e185d55b4937afb515c394066f35 /tests/test_ext_graphviz.py | |
parent | 54c8c012228559c3bf30011977984a60a9299e9b (diff) | |
download | sphinx-git-5b7d237db380a75c27137fb37f0396f4a3dc3ecd.tar.gz |
pytest migration
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() |