From 98d385a6fcc38a18917c60780868a29ed346d2e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 21 Aug 2024 12:00:29 +0200 Subject: [PATCH] m.qr: adapt to different output in qrcode 7.4. --- package/ci/circleci.yml | 9 ++------- plugins/m/test/qr/page-73.html | 37 ++++++++++++++++++++++++++++++++++ plugins/m/test/qr/page.html | 6 +++--- plugins/m/test/test_qr.py | 17 ++++++++++++---- 4 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 plugins/m/test/qr/page-73.html diff --git a/package/ci/circleci.yml b/package/ci/circleci.yml index ed515fae..64232f5f 100644 --- a/package/ci/circleci.yml +++ b/package/ci/circleci.yml @@ -220,7 +220,8 @@ jobs: matplotlib-version: ==3.4.3 # Docutils 0.17 dropped `object_image_types`, test that it works there docutils-version: ==0.17.1 - # 7.4 has different output, no time to bother with that ATM + # 7.4 has different output, however on 3.7 and older it's too annoying + # to check what version is installed, so pin to 7.3 qrcode-version: ==7.3.1 - checkout - test-theme @@ -245,8 +246,6 @@ jobs: # 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 docutils-version: ==0.18.0 - # 7.4 has different output, no time to bother with that ATM - qrcode-version: ==7.3.1 - checkout - test-theme - test-plugins @@ -268,8 +267,6 @@ jobs: # 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 - # 7.4 has different output, no time to bother with that ATM - qrcode-version: ==7.3.1 - checkout - test-theme - test-plugins @@ -291,8 +288,6 @@ jobs: # 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 - # 7.4 has different output, no time to bother with that ATM - qrcode-version: ==7.3.1 - checkout - test-theme - test-plugins diff --git a/plugins/m/test/qr/page-73.html b/plugins/m/test/qr/page-73.html new file mode 100644 index 00000000..4cb9e2c6 --- /dev/null +++ b/plugins/m/test/qr/page-73.html @@ -0,0 +1,37 @@ + + + + + m.qr | A Pelican Blog + + + + + + +
+
+
+
+
+
+

m.qr

+ +

Default:

+

Large stuff inside:

+

Large stuff inside, scaled down.

+ + +
+
+
+
+
+ + \ No newline at end of file diff --git a/plugins/m/test/qr/page.html b/plugins/m/test/qr/page.html index 4cb9e2c6..d81cf5c1 100644 --- a/plugins/m/test/qr/page.html +++ b/plugins/m/test/qr/page.html @@ -24,9 +24,9 @@

m.qr

Default:

-

Large stuff inside:

-

Large stuff inside, scaled down.

- +

Large stuff inside:

+

Large stuff inside, scaled down.

+ diff --git a/plugins/m/test/test_qr.py b/plugins/m/test/test_qr.py index 312f090b..a86677f7 100644 --- a/plugins/m/test/test_qr.py +++ b/plugins/m/test/test_qr.py @@ -25,7 +25,7 @@ import sys -from . import PelicanPluginTestCase +from . import PelicanPluginTestCase, parse_version class Qr(PelicanPluginTestCase): def __init__(self, *args, **kwargs): @@ -37,8 +37,17 @@ class Qr(PelicanPluginTestCase): }) if sys.version_info >= (3, 8): - self.assertEqual(*self.actual_expected_contents('page.html', 'page.html')) + from importlib.metadata import version + # Version 7.4 is likely available on Python 3.7 as well, but we + # don't have importlib there so just assume older Pythons have old + # qrcode packages. + if parse_version(version('qrcode')) >= (7, 4): + file = 'page.html' + else: + file = 'page-73.html' elif sys.version_info >= (3, 7): - self.assertEqual(*self.actual_expected_contents('page.html', 'page-py37.html')) + file = 'page-py37.html' else: - self.assertEqual(*self.actual_expected_contents('page.html', 'page-py36.html')) + file = 'page-py36.html' + + self.assertEqual(*self.actual_expected_contents('page.html', file)) -- 2.30.2