From: Vladimír Vondruš Date: Wed, 21 Aug 2024 10:02:33 +0000 (+0200) Subject: m.plots: adapt tests to different output with matplotlib 3.6+. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=c6a465d8654c1d888d2a7f8adee7aa4c351d14af;p=blog.git m.plots: adapt tests to different output with matplotlib 3.6+. Unfortunately version 3.8+ has different output YET AGAIN, meaning I have to pin again until I build up the patience to retry all this. --- diff --git a/documentation/test_python/page_plugins/plots-35.html b/documentation/test_python/page_plugins/plots-35.html new file mode 100644 index 00000000..9d859681 --- /dev/null +++ b/documentation/test_python/page_plugins/plots-35.html @@ -0,0 +1,163 @@ + + + + + And now something totally different | My Python Project + + + + + +
+
+
+
+
+

+ And now something totally different +

+
+ + + + + + + + + + 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 + + + + + + + + + +
+
+
+
+
+ + diff --git a/documentation/test_python/page_plugins/plots.html b/documentation/test_python/page_plugins/plots.html index 9d859681..53518c0a 100644 --- a/documentation/test_python/page_plugins/plots.html +++ b/documentation/test_python/page_plugins/plots.html @@ -51,7 +51,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 0 + 0 @@ -61,7 +61,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 5 + 5 @@ -71,7 +71,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 10 + 10 @@ -81,7 +81,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 15 + 15 @@ -91,7 +91,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 20 + 20 @@ -101,7 +101,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 25 + 25 @@ -111,11 +111,11 @@ div.m-plot svg { font-family: DejaVu Sans; } - 30 + 30 - meters, i guess? + meters, i guess? @@ -129,7 +129,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - First + First @@ -139,12 +139,12 @@ div.m-plot svg { font-family: DejaVu Sans; } - Second + Second - A plot with a single color + A plot with a single color diff --git a/documentation/test_python/test_page.py b/documentation/test_python/test_page.py index a1cc450d..941665f4 100644 --- a/documentation/test_python/test_page.py +++ b/documentation/test_python/test_page.py @@ -90,12 +90,16 @@ class Plugins(BaseTestCase): # I assume this will be a MASSIVE ANNOYANCE at some point as well so # keeping it separate. (Yes, thank you past mosra. Very helpful.) - if parse_version(matplotlib.__version__) >= parse_version('3.5'): - self.assertEqual(*self.actual_expected_contents('plots.html')) + if parse_version(matplotlib.__version__) >= parse_version('3.6'): + # https://github.com/matplotlib/matplotlib/commit/1cf5a33b5b5fb07f8fd3956322b85efa0e307b18 + file = 'plots.html' + elif parse_version(matplotlib.__version__) >= parse_version('3.5'): + file = 'plots-35.html' elif parse_version(matplotlib.__version__) >= parse_version('3.4'): - self.assertEqual(*self.actual_expected_contents('plots.html', 'plots-34.html')) + file = 'plots-34.html' else: - self.assertEqual(*self.actual_expected_contents('plots.html', 'plots-32.html')) + file = 'plots-32.html' + self.assertEqual(*self.actual_expected_contents('plots.html', file)) self.assertTrue(os.path.exists(os.path.join(self.path, 'output/tiny.png'))) import fancyline diff --git a/package/ci/circleci.yml b/package/ci/circleci.yml index 64232f5f..6679b19d 100644 --- a/package/ci/circleci.yml +++ b/package/ci/circleci.yml @@ -240,8 +240,8 @@ jobs: - install-base: extra: graphviz cmake ninja-build wget - install-python-deps: - # Matplotlib 3.6 has significantly different output AGAIN, pin on 3.5.2 - # until I have it on Arch and can test it locally + # Matplotlib 3.6 has slightly different output, be sure to have at + # least one job testing 3.5 so we don't regress matplotlib-version: ==3.5.2 # Docutils 0.18.0 dropped `in_footnote_list` and made some changes that # 0.18.1 reverted again, test we're not affected by those @@ -264,9 +264,9 @@ jobs: # libtinfo5 needed by doxygen 1.8.18, wtf extra: graphviz cmake ninja-build wget libtinfo5 - install-python-deps: - # Matplotlib 3.6 has significantly different output AGAIN, pin on 3.5.2 - # until I have it on Arch and can test it locally - matplotlib-version: ==3.5.2 + # Matplotlib 3.8+ has significantly different output AGAIN, pin on 3.7 + # until I can be bothered testing yet again + matplotlib-version: ==3.7.4 - checkout - test-theme - test-plugins @@ -285,9 +285,9 @@ jobs: # libtinfo5 needed by doxygen 1.8.18, wtf extra: graphviz cmake ninja-build wget libtinfo5 - install-python-deps: - # Matplotlib 3.6 has significantly different output AGAIN, pin on 3.5.2 - # until I have it on Arch and can test it locally - matplotlib-version: ==3.5.2 + # Matplotlib 3.8+ has significantly different output AGAIN, pin on 3.7 + # until I can be bothered testing yet again + matplotlib-version: ==3.7.4 - checkout - test-theme - test-plugins diff --git a/plugins/m/test/plots/page-35.html b/plugins/m/test/plots/page-35.html new file mode 100644 index 00000000..b01ee253 --- /dev/null +++ b/plugins/m/test/plots/page-35.html @@ -0,0 +1,682 @@ + + + + + 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 + + + + + + + + + +
+
+

A plot with separate colors, extra labels, error bars and custom width + height

+
+ + + + + + + + + + 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 + + + + hell! + + + Yes. + + + + + + + + + +
+
+
+ + + + + + + + + + 111.9 kB + + + 74.4 kB + + + 52.1 kB + + + 731.2 kB + + + 226.3 kB + + + 226.0 kB + + + + + + + + + + + + + + 0 + + + + + + + + + + 100 + + + + + + + + + + 200 + + + + + + + + + + 300 + + + + + + + + + + 400 + + + + + + + + + + 500 + + + + + + + + + + 600 + + + + + + + + + + 700 + + + + + + + + + + 800 + + + + kB + + + + + + + + + + + + + + A + + + + + + + + + + B + + + + + + + + + + C + + + + + Stacked plot + + + + + + + + + +
+
+ + + + + + + + + + 111.9 ± 25.0 kB + + + 74.4 ± 15.3 kB + + + 731.2 ± 200.0 kB + + + 226.3 ± 5.0 kB + + + + + + + + + + + + + + 0 + + + + + + + + + + 200 + + + + + + + + + + 400 + + + + + + + + + + 600 + + + + + + + + + + 800 + + + + + + + + + + 1000 + + + + kB + + + + + + + + + + + + + + A + + + + + + + + + + B + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Stacked plot with errors and full colors + + + + + + + + + +
+ +
+
+
+
+
+ + diff --git a/plugins/m/test/plots/page.html b/plugins/m/test/plots/page.html index b01ee253..8b7c6a8f 100644 --- a/plugins/m/test/plots/page.html +++ b/plugins/m/test/plots/page.html @@ -54,7 +54,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 0 + 0 @@ -64,7 +64,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 5 + 5 @@ -74,7 +74,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 10 + 10 @@ -84,7 +84,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 15 + 15 @@ -94,7 +94,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 20 + 20 @@ -104,7 +104,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 25 + 25 @@ -114,11 +114,11 @@ div.m-plot svg { font-family: DejaVu Sans; } - 30 + 30 - meters, i guess? + meters, i guess? @@ -132,7 +132,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - First + First @@ -142,12 +142,12 @@ div.m-plot svg { font-family: DejaVu Sans; } - Second + Second - A plot with a single color + A plot with a single color @@ -190,7 +190,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 0 + 0 @@ -200,7 +200,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 1 + 1 @@ -210,7 +210,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 2 + 2 @@ -220,7 +220,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 3 + 3 @@ -230,7 +230,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 4 + 4 @@ -240,7 +240,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 5 + 5 @@ -250,11 +250,11 @@ div.m-plot svg { font-family: DejaVu Sans; } - 6 + 6 - Mondays + Mondays @@ -279,7 +279,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - February + February @@ -325,7 +325,7 @@ div.m-plot svg { font-family: DejaVu Sans; } hell! - Yes. + Yes. @@ -376,7 +376,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 0 + 0 @@ -386,7 +386,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 100 + 100 @@ -396,7 +396,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 200 + 200 @@ -406,7 +406,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 300 + 300 @@ -416,7 +416,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 400 + 400 @@ -426,7 +426,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 500 + 500 @@ -436,7 +436,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 600 + 600 @@ -446,7 +446,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 700 + 700 @@ -456,11 +456,11 @@ div.m-plot svg { font-family: DejaVu Sans; } - 800 + 800 - kB + kB @@ -474,7 +474,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - A + A @@ -484,7 +484,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - B + B @@ -494,12 +494,12 @@ div.m-plot svg { font-family: DejaVu Sans; } - C + C - Stacked plot + Stacked plot @@ -543,7 +543,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 0 + 0 @@ -553,7 +553,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 200 + 200 @@ -563,7 +563,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 400 + 400 @@ -573,7 +573,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 600 + 600 @@ -583,7 +583,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - 800 + 800 @@ -593,11 +593,11 @@ div.m-plot svg { font-family: DejaVu Sans; } - 1000 + 1000 - kB + kB @@ -611,7 +611,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - A + A @@ -621,7 +621,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - B + B @@ -661,7 +661,7 @@ div.m-plot svg { font-family: DejaVu Sans; } - Stacked plot with errors and full colors + Stacked plot with errors and full colors diff --git a/plugins/m/test/test_plots.py b/plugins/m/test/test_plots.py index a32bcb97..0e932352 100644 --- a/plugins/m/test/test_plots.py +++ b/plugins/m/test/test_plots.py @@ -41,13 +41,18 @@ class Plots(PelicanPluginTestCase): }) # FUCK this is annoying - if parse_version(matplotlib.__version__) >= parse_version('3.5'): - self.assertEqual(*self.actual_expected_contents('page.html')) + if parse_version(matplotlib.__version__) >= parse_version('3.6'): + # https://github.com/matplotlib/matplotlib/commit/1cf5a33b5b5fb07f8fd3956322b85efa0e307b18 + file = 'page.html' + elif parse_version(matplotlib.__version__) >= parse_version('3.5'): + file = 'page-35.html' elif parse_version(matplotlib.__version__) >= parse_version('3.4'): - self.assertEqual(*self.actual_expected_contents('page.html', 'page-34.html')) + file = 'page-34.html' elif parse_version(matplotlib.__version__) >= parse_version('3.2'): - self.assertEqual(*self.actual_expected_contents('page.html', 'page-32.html')) + file = 'page-32.html' elif parse_version(matplotlib.__version__) >= parse_version('3.0'): - self.assertEqual(*self.actual_expected_contents('page.html', 'page-30.html')) + file = 'page-30.html' else: - self.assertEqual(*self.actual_expected_contents('page.html', 'page-22.html')) + file = 'page-22.html' + + self.assertEqual(*self.actual_expected_contents('page.html', file))