Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package diffoscope for openSUSE:Factory 
checked in at 2022-02-11 23:10:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/diffoscope (Old)
 and      /work/SRC/openSUSE:Factory/.diffoscope.new.1956 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "diffoscope"

Fri Feb 11 23:10:19 2022 rev:27 rq:953798 version:203

Changes:
--------
--- /work/SRC/openSUSE:Factory/diffoscope/diffoscope.changes    2022-01-22 
08:19:15.170471666 +0100
+++ /work/SRC/openSUSE:Factory/.diffoscope.new.1956/diffoscope.changes  
2022-02-11 23:12:22.731461262 +0100
@@ -1,0 +2,71 @@
+Fri Feb  4 16:51:28 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- - update to version 203:
+ - Improve documentation for --timeout due to a few misconceptions.
+   Add an allowed-to-fail test regarding a regression in directory handling.
+ - Tidy control flow in Difference._reverse_self a little.
+ - Fix diffing CBFS names that contain spaces.
+- update to version 202:
+ - Don't fail if comparing a nonexistent file with a .pyc file (and add test).
+   (Closes: #1004312)
+ - Drop a reference in the manual page which claims the ability to compare
+   non-existent files on the command-line. This has not been possible since
+   version 32 which was released in September 2015. (Closes: #1004182)
+ - Add experimental support for incremental output support with a timeout.
+   Passing, for example, --timeout=60 will mean that diffoscope will not
+   recurse into any sub-archives after 60 seconds total execution time has
+   elapsed and mark the diff as being incomplete. (Note that this is not a
+   fixed/strict timeout due to implementation issues.)
+   (Closes: reproducible-builds/diffoscope#301)
+ - Don't return with an exit code of 0 if we encounter device file such as
+   /dev/stdin with human-readable metadata that matches literal, non-device,
+   file contents. (Closes: #1004198)
+ - Correct a "recompile" typo.
+ - Fix/update whitespace for Black 21.12.
+
+-------------------------------------------------------------------
+Fri Jan 28 16:24:38 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- - update to version 202:
+ - Don't fail if comparing a nonexistent file with a .pyc file (and add test).
+   (Closes: #1004312)
+ - Drop a reference in the manual page which claims the ability to compare
+   non-existent files on the command-line. This has not been possible since
+   version 32 which was released in September 2015. (Closes: #1004182)
+ - Add experimental support for incremental output support with a timeout.
+   Passing, for example, --timeout=60 will mean that diffoscope will not
+   recurse into any sub-archives after 60 seconds total execution time has
+   elapsed and mark the diff as being incomplete. (Note that this is not a
+   fixed/strict timeout due to implementation issues.)
+   (Closes: reproducible-builds/diffoscope#301)
+ - Don't return with an exit code of 0 if we encounter device file such as
+   /dev/stdin with human-readable metadata that matches literal, non-device,
+   file contents. (Closes: #1004198)
+ - Correct a "recompile" typo.
+ - Fix/update whitespace for Black 21.12.
+- update to version 201:
+ - If the debian.deb822 module raises any exception on import, re-raise it as
+   an ImportError instead. This should fix diffoscope on some Fedora systems.
+   Thanks to Mattia Rizzolo for suggesting this particular solution.
+   (Closes: reproducible-builds/diffoscope#300)
+ - Fix json detection with file-5.41-3.fc36.x86_64.
+
+-------------------------------------------------------------------
+Fri Jan 21 16:48:00 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- - update to version 201:
+ - If the debian.deb822 module raises any exception on import, re-raise it as
+   an ImportError instead. This should fix diffoscope on some Fedora systems.
+   Thanks to Mattia Rizzolo for suggesting this particular solution.
+   (Closes: reproducible-builds/diffoscope#300)
+ - Fix json detection with file-5.41-3.fc36.x86_64.
+- update to version 200:
+ - Even if a Sphinx .inv inventory file is labelled "The remainder of this
+   file is compressed using zlib", it might not actually be. In this case,
+   don't traceback, and simply return the original content.
+   (Closes: reproducible-builds/diffoscope#299)
+ - Update "X has been modified after NT_GNU_BUILD_ID has been applied" message
+   to, for instance, not duplicating the full filename in the primary
+   diffoscope's output.
+
+-------------------------------------------------------------------

Old:
----
  diffoscope-200.tar.bz2
  diffoscope-200.tar.bz2.asc

New:
----
  diffoscope-203.tar.bz2
  diffoscope-203.tar.bz2.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ diffoscope.spec ++++++
--- /var/tmp/diff_new_pack.95Pwjq/_old  2022-02-11 23:12:23.243462743 +0100
+++ /var/tmp/diff_new_pack.95Pwjq/_new  2022-02-11 23:12:23.251462766 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           diffoscope
-Version:        200
+Version:        203
 Release:        0
 Summary:        In-depth comparison of files, archives, and directories
 License:        GPL-3.0-or-later

++++++ diffoscope-200.tar.bz2 -> diffoscope-203.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/README.rst 
new/diffoscope-203/README.rst
--- old/diffoscope-200/README.rst       2022-01-14 10:15:22.000000000 +0100
+++ new/diffoscope-203/README.rst       2022-02-04 17:13:15.000000000 +0100
@@ -49,10 +49,6 @@
 diffoscope will exit with 0 if there's no differences and 1 if there
 are.
 
-*diffoscope* can also compare non-existent files::
-
-    $ bin/diffoscope /nonexistent archive.zip
-
 To get all possible options, run::
 
     $ bin/diffoscope --help
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/debian/changelog 
new/diffoscope-203/debian/changelog
--- old/diffoscope-200/debian/changelog 2022-01-14 10:15:22.000000000 +0100
+++ new/diffoscope-203/debian/changelog 2022-02-04 17:13:15.000000000 +0100
@@ -1,3 +1,52 @@
+diffoscope (203) unstable; urgency=medium
+
+  [ Chris Lamb ]
+  * Improve documentation for --timeout due to a few misconceptions.
+    Add an allowed-to-fail test regarding a regression in directory handling.
+  * Tidy control flow in Difference._reverse_self a little.
+
+  [ Alyssa Ross ]
+  * Fix diffing CBFS names that contain spaces.
+
+ -- Chris Lamb <la...@debian.org>  Fri, 04 Feb 2022 08:13:13 -0800
+
+diffoscope (202) unstable; urgency=medium
+
+  [ Chris Lamb ]
+  * Don't fail if comparing a nonexistent file with a .pyc file (and add test).
+    (Closes: #1004312)
+  * Drop a reference in the manual page which claims the ability to compare
+    non-existent files on the command-line. This has not been possible since
+    version 32 which was released in September 2015. (Closes: #1004182)
+  * Add experimental support for incremental output support with a timeout.
+    Passing, for example, --timeout=60 will mean that diffoscope will not
+    recurse into any sub-archives after 60 seconds total execution time has
+    elapsed and mark the diff as being incomplete. (Note that this is not a
+    fixed/strict timeout due to implementation issues.)
+    (Closes: reproducible-builds/diffoscope#301)
+  * Don't return with an exit code of 0 if we encounter device file such as
+    /dev/stdin with human-readable metadata that matches literal, non-device,
+    file contents. (Closes: #1004198)
+  * Correct a "recompile" typo.
+
+  [ Sergei Trofimovich ]
+  * Fix/update whitespace for Black 21.12.
+
+ -- Chris Lamb <la...@debian.org>  Fri, 28 Jan 2022 08:17:21 -0800
+
+diffoscope (201) unstable; urgency=medium
+
+  [ Chris Lamb ]
+  * If the debian.deb822 module raises any exception on import, re-raise it as
+    an ImportError instead. This should fix diffoscope on some Fedora systems.
+    Thanks to Mattia Rizzolo for suggesting this particular solution.
+    (Closes: reproducible-builds/diffoscope#300)
+
+  [ Zbigniew J??drzejewski-Szmek ]
+  * Fix json detection with file-5.41-3.fc36.x86_64.
+
+ -- Chris Lamb <la...@debian.org>  Fri, 21 Jan 2022 08:35:36 -0800
+
 diffoscope (200) unstable; urgency=medium
 
   * Even if a Sphinx .inv inventory file is labelled "The remainder of this
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/__init__.py 
new/diffoscope-203/diffoscope/__init__.py
--- old/diffoscope-200/diffoscope/__init__.py   2022-01-14 10:15:22.000000000 
+0100
+++ new/diffoscope-203/diffoscope/__init__.py   2022-02-04 17:13:15.000000000 
+0100
@@ -17,4 +17,4 @@
 # You should have received a copy of the GNU General Public License
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
-VERSION = "200"
+VERSION = "203"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/comparators/cbfs.py 
new/diffoscope-203/diffoscope/comparators/cbfs.py
--- old/diffoscope-200/diffoscope/comparators/cbfs.py   2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/diffoscope/comparators/cbfs.py   2022-02-04 
17:13:15.000000000 +0100
@@ -52,7 +52,7 @@
 class CbfsContainer(Archive):
     @tool_required("cbfstool")
     def entries(self, path):
-        cmd = ["cbfstool", path, "print"]
+        cmd = ["cbfstool", path, "print", "-k"]
         output = our_check_output(cmd).decode("utf-8")
         header = True
         for line in output.rstrip("\n").split("\n"):
@@ -60,7 +60,7 @@
                 if line.startswith("Name"):
                     header = False
                 continue
-            name = line.split()[0]
+            name = line.split("\t", 1)[0]
             if name == "(empty)":
                 continue
             yield name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/comparators/debian.py 
new/diffoscope-203/diffoscope/comparators/debian.py
--- old/diffoscope-200/diffoscope/comparators/debian.py 2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/diffoscope/comparators/debian.py 2022-02-04 
17:13:15.000000000 +0100
@@ -2,7 +2,7 @@
 # diffoscope: in-depth comparison of files, archives, and directories
 #
 # Copyright ?? 2014-2015 J??r??my Bobbio <lu...@debian.org>
-# Copyright ?? 2015-2021 Chris Lamb <la...@debian.org>
+# Copyright ?? 2015-2022 Chris Lamb <la...@debian.org>
 #
 # diffoscope is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,13 @@
 import os.path
 import logging
 
-from debian.deb822 import Dsc, Deb822
+try:
+    from debian.deb822 import Dsc, Deb822
+except:
+    # Import can fail due to apt_pkg.Error (or similar) tracebacks, but let us
+    # re-raise them as ImportErrors so that the Comparator module class
+    # handling just works. (See reproducible-builds/diffoscope#300)
+    raise ImportError
 
 from diffoscope.changes import Changes
 from diffoscope.changes import ChangesFileException
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/comparators/directory.py 
new/diffoscope-203/diffoscope/comparators/directory.py
--- old/diffoscope-200/diffoscope/comparators/directory.py      2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/diffoscope/comparators/directory.py      2022-02-04 
17:13:15.000000000 +0100
@@ -49,7 +49,6 @@
                 self.path,
             ]
 
-
 else:
 
     class Stat(Command):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/comparators/json.py 
new/diffoscope-203/diffoscope/comparators/json.py
--- old/diffoscope-200/diffoscope/comparators/json.py   2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/diffoscope/comparators/json.py   2022-02-04 
17:13:15.000000000 +0100
@@ -38,7 +38,7 @@
 
 class JSONFile(File):
     DESCRIPTION = "JSON files"
-    FILE_TYPE_RE = re.compile(r"^JSON data")  # Requires file 5.35+
+    FILE_TYPE_RE = re.compile(r"^JSON (?:text )?data")  # Requires file 5.35+
 
     @classmethod
     def recognizes(cls, file):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/comparators/python.py 
new/diffoscope-203/diffoscope/comparators/python.py
--- old/diffoscope-200/diffoscope/comparators/python.py 2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/diffoscope/comparators/python.py 2022-02-04 
17:13:15.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # diffoscope: in-depth comparison of files, archives, and directories
 #
-# Copyright ?? 2021 Chris Lamb <la...@debian.org>
+# Copyright ?? 2021???2022 Chris Lamb <la...@debian.org>
 # Copyright ?? 2021 Sergei Trofimovich
 #
 # diffoscope is free software: you can redistribute it and/or modify
@@ -28,6 +28,7 @@
 
 from diffoscope.difference import Difference
 
+from .missing_file import MissingFile
 from .utils.file import File
 
 re_memory_address = re.compile(r" at 0x\w+(?=, )")
@@ -38,6 +39,9 @@
     FILE_TYPE_RE = re.compile(r"^python .*byte-compiled$")
 
     def compare_details(self, other, source=None):
+        if isinstance(other, MissingFile):
+            return []
+
         try:
             return [
                 Difference.from_text(
@@ -49,7 +53,7 @@
                 )
             ]
         except ValueError as exc:
-            self.add_comment("Could not decombile bytecode: {}".format(exc))
+            self.add_comment("Could not decompile bytecode: {}".format(exc))
             return []
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/diffoscope-200/diffoscope/comparators/utils/compare.py 
new/diffoscope-203/diffoscope/comparators/utils/compare.py
--- old/diffoscope-200/diffoscope/comparators/utils/compare.py  2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/diffoscope/comparators/utils/compare.py  2022-02-04 
17:13:15.000000000 +0100
@@ -76,6 +76,17 @@
             if difference is None:
                 difference = Difference(file1.name, file2.name)
             difference.add_details(meta)
+
+    # We cannot use isinstance() etc. because these instances are
+    # abc-instantiated abstract base classes. We cannot even compare
+    # DESCRIPTION attributes either, as the specialize() call above may not
+    # have returned a specific instance.
+    if difference is None and str(type(file1)) != str(type(file2)):
+        difference = Difference(file1.name, file2.name)
+        difference.add_comment(
+            "Types of files differ; human-readable metadata may match literal 
file contents."
+        )
+
     return difference
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/diffoscope-200/diffoscope/comparators/utils/container.py 
new/diffoscope-203/diffoscope/comparators/utils/container.py
--- old/diffoscope-200/diffoscope/comparators/utils/container.py        
2022-01-14 10:15:22.000000000 +0100
+++ new/diffoscope-203/diffoscope/comparators/utils/container.py        
2022-02-04 17:13:15.000000000 +0100
@@ -188,6 +188,12 @@
         from ..directory import compare_meta
 
         def compare_pair(file1, file2, comment):
+            if Config().timeout_exceeded():
+                difference = Difference(file1.name, file2.name)
+                msg = "Timeout exceeded; details may be incomplete."
+                difference.add_comment(msg)
+                return difference
+
             difference = compare_files(
                 file1, file2, source=None, diff_content_only=no_recurse
             )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/comparators/utils/file.py 
new/diffoscope-203/diffoscope/comparators/utils/file.py
--- old/diffoscope-200/diffoscope/comparators/utils/file.py     2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/diffoscope/comparators/utils/file.py     2022-02-04 
17:13:15.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # diffoscope: in-depth comparison of files, archives, and directories
 #
-# Copyright ?? 2016-2021 Chris Lamb <la...@debian.org>
+# Copyright ?? 2016-2022 Chris Lamb <la...@debian.org>
 #
 # diffoscope is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -434,6 +434,12 @@
                 msg = "Reached max container depth ({})".format(depth)
                 logger.debug(msg)
                 difference.add_comment(msg)
+            elif Config().timeout_exceeded():
+                msg = "Timeout exceeded; details may be incomplete."
+                logger.debug(msg)
+                difference.add_comment(msg)
+                no_recurse = True
+
             details.extend(
                 self.as_container.compare(
                     other.as_container, no_recurse=no_recurse
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/config.py 
new/diffoscope-203/diffoscope/config.py
--- old/diffoscope-200/diffoscope/config.py     2022-01-14 10:15:22.000000000 
+0100
+++ new/diffoscope-203/diffoscope/config.py     2022-02-04 17:13:15.000000000 
+0100
@@ -2,7 +2,7 @@
 # diffoscope: in-depth comparison of files, archives, and directories
 #
 # Copyright ?? 2015 Reiner Herrmann <rei...@reiner-h.de>
-# Copyright ?? 2016-2017, 2019-2021 Chris Lamb <la...@debian.org>
+# Copyright ?? 2016-2017, 2019-2022 Chris Lamb <la...@debian.org>
 #
 # diffoscope is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
 
 
 import logging
+import time
 
 
 logger = logging.getLogger(__name__)
@@ -69,6 +70,9 @@
         self.use_dbgsym = "auto"
         self.force_details = False
 
+        self.started = time.time()
+        self.timeout = float("inf")
+
     def __setattr__(self, k, v):
         super(Config, self).__setattr__(k, v)
 
@@ -76,23 +80,26 @@
         va = getattr(self, a)
         vb = getattr(self, b)
         if va < vb:
-            if isinstance(vb, defaultint):
-                logger.warning(
-                    "%s (%s) < default value of %s (%s), setting latter to %s",
-                    a,
-                    va,
-                    b,
-                    vb,
-                    va,
-                )
-                setattr(self, b, va)
-            else:
+            if not isinstance(vb, defaultint):
                 raise ValueError(
                     "{0} ({1}) cannot be smaller than {2} ({3})".format(
                         a, va, b, vb
                     )
                 )
 
+            logger.warning(
+                "%s (%s) < default value of %s (%s), setting latter to %s",
+                a,
+                va,
+                b,
+                vb,
+                va,
+            )
+            setattr(self, b, va)
+
     def check_constraints(self):
         self.check_ge("max_diff_block_lines", "max_page_diff_block_lines")
         self.check_ge("max_report_size", "max_page_size")
+
+    def timeout_exceeded(self):
+        return (self.started + self.timeout) < time.time()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/difference.py 
new/diffoscope-203/diffoscope/difference.py
--- old/diffoscope-200/diffoscope/difference.py 2022-01-14 10:15:22.000000000 
+0100
+++ new/diffoscope-203/diffoscope/difference.py 2022-02-04 17:13:15.000000000 
+0100
@@ -116,11 +116,11 @@
             raise NotImplementedError(
                 "_reverse_self on VisualDifference is not yet implemented"
             )
-        unified_diff = (
-            reverse_unified_diff(self.unified_diff)
-            if self.unified_diff is not None
-            else None
-        )
+
+        unified_diff = None
+        if self.unified_diff is not None:
+            unified_diff = reverse_unified_diff(self.unified_diff)
+
         return self.__class__(
             self.source2,
             self.source1,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/diffoscope/main.py 
new/diffoscope-203/diffoscope/main.py
--- old/diffoscope-200/diffoscope/main.py       2022-01-14 10:15:22.000000000 
+0100
+++ new/diffoscope-203/diffoscope/main.py       2022-02-04 17:13:15.000000000 
+0100
@@ -4,7 +4,7 @@
 # diffoscope: in-depth comparison of files, archives, and directories
 #
 # Copyright ?? 2014-2015 J??r??my Bobbio <lu...@debian.org>
-# Copyright ?? 2016-2021 Chris Lamb <la...@debian.org>
+# Copyright ?? 2016-2022 Chris Lamb <la...@debian.org>
 #
 # diffoscope is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -367,6 +367,15 @@
         default=Config().max_container_depth,
     )
     group3.add_argument(
+        "--timeout",
+        metavar="SECONDS",
+        type=int,
+        help="Best-effort attempt at a global timeout in seconds. If enabled, "
+        "diffoscope will not recurse into any further sub-archives after X "
+        "seconds of total execution time. (default: no timeout) 
[experimental]",
+        default=float("inf"),
+    )
+    group3.add_argument(
         "--max-diff-block-lines-saved",
         metavar="LINES",
         type=int,
@@ -628,6 +637,7 @@
     Config().use_dbgsym = parsed_args.use_dbgsym
     Config().force_details = parsed_args.force_details
     Config().fuzzy_threshold = parsed_args.fuzzy_threshold
+    Config().timeout = parsed_args.timeout
     Config().max_container_depth = parsed_args.max_container_depth
 
     Config().excludes = parsed_args.excludes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/tests/comparators/test_cbfs.py 
new/diffoscope-203/tests/comparators/test_cbfs.py
--- old/diffoscope-200/tests/comparators/test_cbfs.py   2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/tests/comparators/test_cbfs.py   2022-02-04 
17:13:15.000000000 +0100
@@ -51,7 +51,7 @@
             "-f",
             TEST_FILE1_PATH,
             "-n",
-            "text",
+            "test file",
             "-t",
             "raw",
         ),
@@ -77,7 +77,7 @@
             "-f",
             TEST_FILE2_PATH,
             "-n",
-            "text",
+            "test file",
             "-t",
             "raw",
         ),
@@ -128,13 +128,13 @@
     # and the git log of this file), perform only these basic coherence check.
 
     assert differences[0].source1.startswith("cbfstool")
-    assert re.search(r"\+text\s.*\sraw\s", differences[0].unified_diff)
+    assert re.search(r"\+test file\s.*\sraw\s", differences[0].unified_diff)
 
 
 @skip_unless_tools_exist("cbfstool")
 def test_content(differences):
-    assert differences[1].source1 == "text"
-    assert differences[1].source2 == "text"
+    assert differences[1].source1 == "test file"
+    assert differences[1].source2 == "test file"
     expected_diff = get_data("text_ascii_expected_diff")
     assert differences[1].unified_diff == expected_diff
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/tests/comparators/test_directory.py 
new/diffoscope-203/tests/comparators/test_directory.py
--- old/diffoscope-200/tests/comparators/test_directory.py      2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/tests/comparators/test_directory.py      2022-02-04 
17:13:15.000000000 +0100
@@ -111,3 +111,16 @@
     b = specialize(FilesystemFile(path))
 
     assert a.compare(b).unified_diff == get_data("test_directory_symlink_diff")
+
+
+@pytest.mark.xfail(strict=False)
+def test_compare_both_ways(tmpdir):
+    """
+    Comparing a directory with a file shouldn't crash, but nor should as
+    comparing a file with a directory either. (Re: #292)
+    """
+
+    a = specialize(FilesystemFile(str(tmpdir)))
+    b = specialize(FilesystemFile(TEST_FILE1_PATH))
+    a.compare(b)
+    b.compare(a)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/tests/comparators/test_python.py 
new/diffoscope-203/tests/comparators/test_python.py
--- old/diffoscope-200/tests/comparators/test_python.py 2022-01-14 
10:15:22.000000000 +0100
+++ new/diffoscope-203/tests/comparators/test_python.py 2022-02-04 
17:13:15.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # diffoscope: in-depth comparison of files, archives, and directories
 #
-# Copyright ?? 2021 Chris Lamb <la...@debian.org>
+# Copyright ?? 2021???2022 Chris Lamb <la...@debian.org>
 #
 # diffoscope is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
 from diffoscope.comparators.python import PycFile
 
 from ..utils.data import assert_diff_startswith, load_fixture
+from ..utils.nonexisting import assert_non_existing
 from ..utils.tools import (
     skipif,
     skip_unless_file_version_is_at_least,
@@ -60,3 +61,9 @@
         differences[0],
         "pyc_expected_diff",
     )
+
+
+def test_compare_non_existing(monkeypatch, pyc1):
+    assert_non_existing(
+        monkeypatch, pyc1, has_details=False, has_null_source=False
+    )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-200/tests/test_source.py 
new/diffoscope-203/tests/test_source.py
--- old/diffoscope-200/tests/test_source.py     2022-01-14 10:15:22.000000000 
+0100
+++ new/diffoscope-203/tests/test_source.py     2022-02-04 17:13:15.000000000 
+0100
@@ -256,7 +256,7 @@
     ]
 
 
-@skip_unless_tool_is_at_least("black", black_version, "21.4b2")
+@skip_unless_tool_is_at_least("black", black_version, "21.12b0")
 def test_code_is_black_clean():
     output = subprocess.check_output(
         ("black", "--diff", "."), stderr=subprocess.PIPE

Reply via email to