[diffoscope] 01/01: Ensure imagemagick version is new enough for image metadata tests.
Maria Glukhova
siamezzze-guest at moszumanska.debian.org
Sun Jan 15 14:47:57 CET 2017
This is an automated email from the git hooks/post-receive script.
siamezzze-guest pushed a commit to branch master
in repository diffoscope.
commit 6d6fddd26e6883dfc26342101c42fedc83b55461
Author: Maria Glukhova <siamezzze at gmail.com>
Date: Sun Jan 15 15:34:39 2017 +0200
Ensure imagemagick version is new enough for image metadata tests.
Skip image metadata tests if imagemagick is too old and identify has different output format (fixes tests in jessie-bpo).
---
tests/comparators/test_ico_image.py | 5 ++++-
tests/comparators/test_jpeg_image.py | 11 ++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/tests/comparators/test_ico_image.py b/tests/comparators/test_ico_image.py
index 3cebd78..e50afd4 100644
--- a/tests/comparators/test_ico_image.py
+++ b/tests/comparators/test_ico_image.py
@@ -22,7 +22,9 @@ import pytest
from diffoscope.config import Config
from diffoscope.comparators.image import ICOImageFile
-from utils import skip_unless_tools_exist, data, load_fixture
+from utils import skip_unless_tools_exist, data, load_fixture, \
+ skip_unless_tool_is_at_least
+from test_jpeg_image import identify_version
image1 = load_fixture(data('test1.ico'))
image2 = load_fixture(data('test2.ico'))
@@ -50,6 +52,7 @@ def differences_meta(image1_meta, image2_meta):
return image1_meta.compare(image2_meta).details
@skip_unless_tools_exist('img2txt', 'identify')
+ at skip_unless_tool_is_at_least('identify', identify_version, '6.9.6')
def test_diff_meta(differences_meta):
expected_diff = open(data('ico_image_meta_expected_diff')).read()
assert differences_meta[-1].unified_diff == expected_diff
diff --git a/tests/comparators/test_jpeg_image.py b/tests/comparators/test_jpeg_image.py
index 691b713..194bc64 100644
--- a/tests/comparators/test_jpeg_image.py
+++ b/tests/comparators/test_jpeg_image.py
@@ -18,18 +18,26 @@
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
import pytest
+import subprocess
from diffoscope.config import Config
from diffoscope.comparators.image import JPEGImageFile
from diffoscope.comparators.missing_file import MissingFile
-from utils import skip_unless_tools_exist, data, load_fixture
+from utils import skip_unless_tools_exist, data, load_fixture, \
+ skip_unless_tool_is_at_least
image1 = load_fixture(data('test1.jpg'))
image2 = load_fixture(data('test2.jpg'))
image1_meta = load_fixture(data('test1_meta.jpg'))
image2_meta = load_fixture(data('test2_meta.jpg'))
+def identify_version():
+ out = subprocess.check_output(['identify', '-version'])
+ # First line is expected to look like
+ # "Version: ImageMagick 6.9.6-6 Q16 x86_64 20161125 ..."
+ return out.decode('utf-8').splitlines()[0].split()[2].strip()
+
def test_identification(image1):
assert isinstance(image1, JPEGImageFile)
@@ -58,6 +66,7 @@ def differences_meta(image1_meta, image2_meta):
return image1_meta.compare(image2_meta).details
@skip_unless_tools_exist('img2txt', 'identify')
+ at skip_unless_tool_is_at_least('identify', identify_version, '6.9.6')
def test_diff_meta(differences_meta):
expected_diff = open(data('jpeg_image_meta_expected_diff')).read()
assert differences_meta[-1].unified_diff == expected_diff
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list