Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 915590f

Browse filesBrowse files
committed
TST: skip test_dviread if kpsewhich is not available
Also fix the docstring to mention that it is part of miktex...
1 parent 2a4863c commit 915590f
Copy full SHA for 915590f

File tree

Expand file treeCollapse file tree

3 files changed

+26
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+26
-2
lines changed

‎lib/matplotlib/dviread.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dviread.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,8 @@ def find_tex_file(filename, format=None):
961961
`--format` option.
962962
963963
Apparently most existing TeX distributions on Unix-like systems
964-
use kpathsea. I hear MikTeX (a popular distribution on Windows)
965-
doesn't use kpathsea, so what do we do? (TODO)
964+
use kpathsea. It's also available as part of MikTeX, a popular
965+
distribution on Windows.
966966
967967
.. seealso::
968968

‎lib/matplotlib/testing/decorators.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/decorators.py
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,24 @@ def backend_switcher(*args, **kwargs):
426426

427427
return nose.tools.make_decorator(func)(backend_switcher)
428428
return switch_backend_decorator
429+
430+
431+
def skip_if_command_unavailable(cmd):
432+
"""
433+
skips a test if a command is unavailable.
434+
435+
Parameters
436+
----------
437+
cmd : list of str
438+
must be a complete command which should not
439+
return a non zero exit code, something like
440+
["latex", "-version"]
441+
"""
442+
from matplotlib.compat.subprocess import check_output
443+
try:
444+
check_output(cmd)
445+
except:
446+
from nose import SkipTest
447+
raise SkipTest('missing command: %s' % cmd[0])
448+
449+
return lambda f: f

‎lib/matplotlib/tests/test_dviread.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_dviread.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
unicode_literals)
33

44
from matplotlib.externals import six
5+
from matplotlib.testing.decorators import skip_if_command_unavailable
6+
57

68
from nose.tools import assert_equal, with_setup
79
import matplotlib.dviread as dr
@@ -60,6 +62,7 @@ def test_PsfontsMap():
6062
assert_equal(entry.filename, '/absolute/font9.pfb')
6163

6264

65+
@skip_if_command_unavailable(["kpsewhich", "-version"])
6366
def test_dviread():
6467
dir = os.path.join(os.path.dirname(__file__), 'baseline_images', 'dviread')
6568
with open(os.path.join(dir, 'test.json')) as f:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.