[Git][reproducible-builds/diffoscope][master] 2 commits: Drop print() statement in PPU tests.

Chris Lamb gitlab at salsa.debian.org
Mon Sep 17 09:29:35 CEST 2018


Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
755c2184 by Chris Lamb at 2018-09-17T07:29:12Z
Drop print() statement in PPU tests.

- - - - -
b1addb0d by Chris Lamb at 2018-09-17T07:29:15Z
Fix tests under colord >= 1.4.3. (Closes: #908900)

The `cd-iccdump` command has no --version command and, whilst the `colord`
binary does, it relies on the daemon running to return any output.  Therefore
we hackily compare the output (via the line length) of colord 1.4.3:

    "  Profile ID    = 0477fa4bb5ae5ae9a778f5cd72eb45a4"

... versus, for example, colord 1.3.3:

    " Profile ID    = 0x0477fa4b"

We don't massage the output (say, in an `Iccdump.filter` method) as it would
remove the accuracy and, unfortunately, colord 1.4.3 also removes a
somewhat-arbitrary newline too.

- - - - -


3 changed files:

- tests/comparators/test_icc.py
- tests/comparators/test_ppu.py
- tests/data/icc_expected_diff


Changes:

=====================================
tests/comparators/test_icc.py
=====================================
@@ -18,19 +18,46 @@
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
 import pytest
+import subprocess
 
 from diffoscope.config import Config
 from diffoscope.comparators.icc import IccFile
 from diffoscope.comparators.missing_file import MissingFile
 
 from ..utils.data import load_fixture, get_data
-from ..utils.tools import skip_unless_tools_exist
+from ..utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 
 
 icc1 = load_fixture('test1.icc')
 icc2 = load_fixture('test2.icc')
 
 
+def cd_iccdump_version():
+    """
+    The `cd-iccdump` command has no --version command and, whilst the `colord`
+    binary does, it relies on the daemon running to return any output.
+    Therefore we hackily compare the output (via the line length) of colord
+    1.4.3:
+
+        "  Profile ID    = 0477fa4bb5ae5ae9a778f5cd72eb45a4"
+
+    ... versus, for example, colord 1.3.3:
+
+        " Profile ID    = 0x0477fa4b"
+
+    We don't massage the output (say, in an `Iccdump.filter` method) as it
+    would remove the accuracy and, unfortunately, colord 1.4.3 also removes a
+    somewhat-arbitrary newline too.
+    """
+
+    val = subprocess.check_output(('cd-iccdump', icc1().path)).decode('utf-8')
+
+    for x in val.splitlines():
+        if x.startswith('  Profile ID') and len(x) == 47:
+            return '1.4.3'
+    return '1.3.3'
+
+
 def test_identification(icc1):
     assert isinstance(icc1, IccFile)
 
@@ -45,7 +72,7 @@ def differences(icc1, icc2):
     return icc1.compare(icc2).details
 
 
- at skip_unless_tools_exist('cd-iccdump')
+ at skip_unless_tool_is_at_least('cd-iccdump', cd_iccdump_version, '1.4.3')
 def test_diff(differences):
     if 'ne_SU' in differences[0].unified_diff:
         pytest.skip("Endian-specific differences detected; see "


=====================================
tests/comparators/test_ppu.py
=====================================
@@ -62,7 +62,6 @@ def differences(file1, file2):
 
 @skip_unless_tool_is_at_least('ppudump', ppudump_version, '3.0.0')
 def test_diff(differences):
-    print(differences[0].unified_diff)
     expected_diff = get_data('ppu_expected_diff')
     assert differences[0].unified_diff == expected_diff
 


=====================================
tests/data/icc_expected_diff
=====================================
@@ -12,12 +12,12 @@
    Dev. Attrbts	= reflective, glossy
    Rndrng Intnt	= perceptual
    Creator	= lcms
--  Profile ID	= 0x0477fa4b
-+  Profile ID	= 0x06017f17
- 
+-  Profile ID	= 0477fa4bb5ae5ae9a778f5cd72eb45a4
++  Profile ID	= 06017f17ec507191e9d859f2324fca53
  tag 00:
    sig	'desc' [0x64657363]
    size	38
    type	'mluc' [0x6d6c7563]
  Text:
    en_US:	sRGB [24 bytes]
+ 



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/9489b358e4bd8460bca4b2ef9f6a61447b155813...b1addb0d00a6e1297e3ab1bf3dcb3af804f4b8b7

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/9489b358e4bd8460bca4b2ef9f6a61447b155813...b1addb0d00a6e1297e3ab1bf3dcb3af804f4b8b7
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20180917/6eaae61d/attachment.html>


More information about the rb-commits mailing list