mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
tests: Skip tests with missing binaries
While there are already some skips included here, they clearly aren't doing their job and the test fail locally. Resolve this. Signed-off-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
parent
a102e8e29b
commit
41c19ddf91
@ -9,11 +9,25 @@
|
|||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
def has_binary(binary):
|
||||||
|
try:
|
||||||
|
subprocess.check_output([binary])
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno == os.errno.ENOENT:
|
||||||
|
# handle file not found error.
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx(
|
@pytest.mark.sphinx(
|
||||||
'html', testroot='ext-math',
|
'html', testroot='ext-math',
|
||||||
confoverrides = {'extensions': ['sphinx.ext.jsmath'], 'jsmath_path': 'dummy.js'})
|
confoverrides = {'extensions': ['sphinx.ext.jsmath'], 'jsmath_path': 'dummy.js'})
|
||||||
@ -34,6 +48,8 @@ def test_jsmath(app, status, warning):
|
|||||||
assert '<div class="math">\na + 1 < b</div>' in content
|
assert '<div class="math">\na + 1 < b</div>' in content
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not has_binary('dvipng'),
|
||||||
|
reason='Requires dvipng" binary')
|
||||||
@pytest.mark.sphinx('html', testroot='ext-math-simple',
|
@pytest.mark.sphinx('html', testroot='ext-math-simple',
|
||||||
confoverrides = {'extensions': ['sphinx.ext.imgmath']})
|
confoverrides = {'extensions': ['sphinx.ext.imgmath']})
|
||||||
def test_imgmath_png(app, status, warning):
|
def test_imgmath_png(app, status, warning):
|
||||||
@ -49,6 +65,8 @@ def test_imgmath_png(app, status, warning):
|
|||||||
assert re.search(html, content, re.S)
|
assert re.search(html, content, re.S)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not has_binary('dvisvgm'),
|
||||||
|
reason='Requires dvisvgm" binary')
|
||||||
@pytest.mark.sphinx('html', testroot='ext-math-simple',
|
@pytest.mark.sphinx('html', testroot='ext-math-simple',
|
||||||
confoverrides={'extensions': ['sphinx.ext.imgmath'],
|
confoverrides={'extensions': ['sphinx.ext.imgmath'],
|
||||||
'imgmath_image_format': 'svg'})
|
'imgmath_image_format': 'svg'})
|
||||||
|
Loading…
Reference in New Issue
Block a user