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 bbe421a

Browse filesBrowse files
committed
Merge pull request #5922 from JanSchulz/fix_tests_on_windows
Fixes for Windows test failures on appveyor
2 parents 7ed2df9 + 47481d7 commit bbe421a
Copy full SHA for bbe421a

File tree

Expand file treeCollapse file tree

13 files changed

+359
-15
lines changed
Filter options
Expand file treeCollapse file tree

13 files changed

+359
-15
lines changed

‎appveyor.yml

Copy file name to clipboardExpand all lines: appveyor.yml
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ test_script:
8888
# Now build the thing..
8989
- '%CMD_IN_ENV% python setup.py develop'
9090
# tests
91-
# for now, just let them pass to get the after_test parts...
92-
- python tests.py || cmd /c "exit /b 0"
91+
- python tests.py
92+
- python visual_tests.py
9393

9494
after_test:
9595
# After the tests were a success, build packages (wheels and conda)
@@ -126,6 +126,7 @@ artifacts:
126126
type: zip
127127

128128
on_failure:
129+
- python visual_tests.py
129130
- echo zipping images after a failure...
130-
- 7z a result_images.zip result_images\ >NUL:
131+
- 7z a result_images.zip result_images\ |grep -v "Compressing"
131132
- appveyor PushArtifact result_images.zip

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,8 +1530,13 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
15301530

15311531
with io.open(outfile, 'rb') as fh:
15321532
if exit_status:
1533-
raise RuntimeError('ghostscript was not able to process \
1534-
your image.\nHere is the full report generated by ghostscript:\n\n' + fh.read())
1533+
output = fh.read()
1534+
m = "\n".join(["ghostscript was not able to process your image.",
1535+
"Here is the full report generated by ghostscript:",
1536+
"",
1537+
"%s"])
1538+
# use % to prevent problems with bytes
1539+
raise RuntimeError(m % output)
15351540
else:
15361541
verbose.report(fh.read(), 'debug')
15371542
os.remove(outfile)

‎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/compare.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/compare.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def convert(filename, cache):
166166
"""
167167
base, extension = filename.rsplit('.', 1)
168168
if extension not in converter:
169-
raise ImageComparisonFailure(
170-
"Don't know how to convert %s files to png" % extension)
169+
from nose import SkipTest
170+
raise SkipTest("Don't know how to convert %s files to png" % extension)
171171
newname = base + '_' + extension + '.png'
172172
if not os.path.exists(filename):
173173
raise IOError("'%s' does not exist" % filename)

‎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_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
import warnings
2727
from matplotlib.cbook import IgnoredKeywordWarning
2828

29+
import sys
30+
on_win = (sys.platform == 'win32')
31+
2932
# Note: Some test cases are run twice: once normally and once with labeled data
3033
# These two must be defined in the same test function or need to have
3134
# different baseline images to prevent race conditions when nose runs
@@ -2749,7 +2752,8 @@ def test_subplot_key_hash():
27492752

27502753
@image_comparison(baseline_images=['specgram_freqs',
27512754
'specgram_freqs_linear'],
2752-
remove_text=True, extensions=['png'], tol=0.03)
2755+
remove_text=True, extensions=['png'],
2756+
tol=0.05 if on_win else 0.03)
27532757
def test_specgram_freqs():
27542758
'''test axes.specgram in default (psd) mode with sinusoidal stimuli'''
27552759
n = 10000
@@ -2849,7 +2853,8 @@ def test_specgram_noise():
28492853

28502854
@image_comparison(baseline_images=['specgram_magnitude_freqs',
28512855
'specgram_magnitude_freqs_linear'],
2852-
remove_text=True, extensions=['png'], tol=0.03)
2856+
remove_text=True, extensions=['png'],
2857+
tol=0.05 if on_win else 0.03)
28532858
def test_specgram_magnitude_freqs():
28542859
'''test axes.specgram in magnitude mode with sinusoidal stimuli'''
28552860
n = 10000
@@ -2950,7 +2955,8 @@ def test_specgram_magnitude_noise():
29502955

29512956

29522957
@image_comparison(baseline_images=['specgram_angle_freqs'],
2953-
remove_text=True, extensions=['png'])
2958+
remove_text=True, extensions=['png'],
2959+
tol=0.003 if on_win else 0)
29542960
def test_specgram_angle_freqs():
29552961
'''test axes.specgram in angle mode with sinusoidal stimuli'''
29562962
n = 10000

‎lib/matplotlib/tests/test_backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_ps.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_savefig_to_stringio_with_distiller():
7171

7272
@cleanup
7373
@needs_tex
74+
@needs_ghostscript
7475
def test_savefig_to_stringio_with_usetex():
7576
matplotlib.rcParams['text.latex.unicode'] = True
7677
matplotlib.rcParams['text.usetex'] = True
@@ -90,6 +91,7 @@ def test_savefig_to_stringio_eps_afm():
9091

9192
@cleanup
9293
@needs_tex
94+
@needs_ghostscript
9395
def test_savefig_to_stringio_with_usetex_eps():
9496
matplotlib.rcParams['text.latex.unicode'] = True
9597
matplotlib.rcParams['text.usetex'] = True

‎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:

‎lib/matplotlib/tests/test_patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_patches.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
from matplotlib import path as mpath
2121
from matplotlib import transforms as mtrans
2222

23+
import sys
24+
on_win = (sys.platform == 'win32')
25+
2326

2427
def test_Polygon_close():
2528
#: Github issue #1018 identified a bug in the Polygon handling
@@ -250,7 +253,7 @@ def test_wedge_movement():
250253

251254

252255
@image_comparison(baseline_images=['wedge_range'],
253-
remove_text=True)
256+
remove_text=True, tol=0.06 if on_win else 0)
254257
def test_wedge_range():
255258
ax = plt.axes()
256259

‎lib/matplotlib/tests/test_patheffects.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_patheffects.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
import mock
1818
from nose.tools import assert_equal
1919

20+
import sys
21+
on_win = (sys.platform == 'win32')
22+
2023

2124
@image_comparison(baseline_images=['patheffect1'], remove_text=True)
2225
def test_patheffect1():
@@ -110,7 +113,7 @@ def test_SimplePatchShadow_offset():
110113
assert_equal(pe._offset, (4, 5))
111114

112115

113-
@image_comparison(baseline_images=['collection'])
116+
@image_comparison(baseline_images=['collection'], tol=0.013 if on_win else 0)
114117
def test_collection():
115118
x, y = np.meshgrid(np.linspace(0, 10, 150), np.linspace(-5, 5, 100))
116119
data = np.sin(x) + np.cos(y)

‎lib/matplotlib/tests/test_triangulation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_triangulation.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import matplotlib.cm as cm
1515
from matplotlib.path import Path
1616

17+
import sys
18+
on_win = (sys.platform == 'win32')
1719

1820
def test_delaunay():
1921
# No duplicate points, regular grid.
@@ -770,7 +772,8 @@ def z(x, y):
770772

771773

772774
@image_comparison(baseline_images=['tri_smooth_gradient'],
773-
extensions=['png'], remove_text=True)
775+
extensions=['png'], remove_text=True,
776+
tol=0.015 if on_win else 0)
774777
def test_tri_smooth_gradient():
775778
# Image comparison based on example trigradient_demo.
776779

0 commit comments

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