From: Vladimír Vondruš Date: Wed, 16 May 2018 10:12:48 +0000 (+0200) Subject: m.plots: work around test failure on Travis. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=f09b5c0baae00d12c2a7a8fb632c4a08d6baef7d;p=blog.git m.plots: work around test failure on Travis. Only one ID is different, which is still okay to validate a separate test case. --- diff --git a/package/ci/travis.yml b/package/ci/travis.yml index d41b662b..9bbeb2d5 100644 --- a/package/ci/travis.yml +++ b/package/ci/travis.yml @@ -8,6 +8,7 @@ matrix: - WITH_THEME=ON - WITH_DOXYGEN=OFF - WITH_NODE=OFF + - TRAVIS_BROKEN_MATPLOTLIB_SEED=YES - JOBID=py34 - language: python python: 3.5 @@ -22,6 +23,7 @@ matrix: - WITH_THEME=ON - WITH_DOXYGEN=ON - WITH_NODE=OFF + - TRAVIS_BROKEN_MATPLOTLIB_SEED=YES - JOBID=py36 - language: node_js node_js: 8 diff --git a/pelican-plugins/m/test/plots/page-travis-broken-matplotlib-seed.html b/pelican-plugins/m/test/plots/page-travis-broken-matplotlib-seed.html new file mode 100644 index 00000000..c676996e --- /dev/null +++ b/pelican-plugins/m/test/plots/page-travis-broken-matplotlib-seed.html @@ -0,0 +1,353 @@ + + + + + m.plots | A Pelican Blog + + + + + + +
+
+
+
+
+
+

m.plots

+ +

Note: the test uses DejaVu Sans instead of Source Sans Pro in order to have +predictable rendering on the CIs.

+
+ + + + + + + + + + 15.0 meters, i guess? + + + 30.0 meters, i guess? + + + + + + + + + + + + + + 0 + + + + + + + + + + 5 + + + + + + + + + + 10 + + + + + + + + + + 15 + + + + + + + + + + 20 + + + + + + + + + + 25 + + + + + + + + + + 30 + + + + meters, i guess? + + + + + + + + + + + + + + First + + + + + + + + + + Second + + + + + A plot with a single color + + + + + + + + + +
+
+ + + + + + + + + + 3.0 ± 0.1 Mondays + + + 4.0 ± 2.1 Mondays + + + 5.0 ± 1.0 Mondays + + + + + + + + + + + + + + 0 + + + + + + + + + + 1 + + + + + + + + + + 2 + + + + + + + + + + 3 + + + + + + + + + + 4 + + + + + + + + + + 5 + + + + + + + + + + 6 + + + + Mondays + + + + + + + + + + + + + + January + + + + + + + + + + + February + + + + + + + + + + + March + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a paradise + + + + okay + + + + hell! + + + A plot with separate colors, extra labels, error bars and custom height + + + + + + + + + +
+ +
+
+
+
+
+ + diff --git a/pelican-plugins/m/test/test_plots.py b/pelican-plugins/m/test/test_plots.py index e9a7a87f..40f40d97 100644 --- a/pelican-plugins/m/test/test_plots.py +++ b/pelican-plugins/m/test/test_plots.py @@ -22,12 +22,17 @@ # DEALINGS IN THE SOFTWARE. # +import os +import unittest + from . import PluginTestCase class Plots(PluginTestCase): def __init__(self, *args, **kwargs): super().__init__(__file__, '', *args, **kwargs) + @unittest.skipIf(os.environ.get('TRAVIS_BROKEN_MATPLOTLIB_SEED'), + "Travis Python 3.4 and 3.6 has broken matplotlib seed, causing different clip-path ID") def test(self): self.run_pelican({ 'PLUGINS': ['m.htmlsanity', 'm.plots'], @@ -35,3 +40,13 @@ class Plots(PluginTestCase): }) self.assertEqual(*self.actual_expected_contents('page.html')) + + @unittest.skipUnless(os.environ.get('TRAVIS_BROKEN_MATPLOTLIB_SEED'), + "Travis Python 3.4 and 3.6 has different matplotlib seed, causing different clip-path ID") + def test_broken_seed(self): + self.run_pelican({ + 'PLUGINS': ['m.htmlsanity', 'm.plots'], + 'M_PLOTS_FONT': 'DejaVu Sans' + }) + + self.assertEqual(*self.actual_expected_contents('page.html', 'page-travis-broken-matplotlib-seed.html'))