[diffoscope] 06/09: Improve tests for comparisons against non-existing files
Jérémy Bobbio
lunar at moszumanska.debian.org
Tue Jan 19 18:22:30 CET 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository diffoscope.
commit 8cb6d89dc9b94aaebd9c9874ce0edd2aa4bec433
Author: Jérémy Bobbio <lunar at debian.org>
Date: Tue Jan 19 14:51:32 2016 +0000
Improve tests for comparisons against non-existing files
Make sure tests for comparisons against non-existing files don't fall back on
binary comparisons.
---
tests/comparators/test_bzip2.py | 1 +
tests/comparators/test_fonts.py | 1 +
tests/comparators/test_gettext.py | 1 +
tests/comparators/test_image.py | 1 +
tests/comparators/test_java.py | 1 +
tests/comparators/test_macho.py | 1 +
tests/comparators/test_mono.py | 1 +
tests/comparators/test_pdf.py | 1 +
tests/comparators/test_png.py | 1 +
tests/comparators/test_ppu.py | 1 +
tests/comparators/test_sqlite.py | 1 +
11 files changed, 11 insertions(+)
diff --git a/tests/comparators/test_bzip2.py b/tests/comparators/test_bzip2.py
index 6b0a9c2..84ab16a 100644
--- a/tests/comparators/test_bzip2.py
+++ b/tests/comparators/test_bzip2.py
@@ -77,3 +77,4 @@ def test_compare_non_existing(monkeypatch, bzip1):
monkeypatch.setattr(Config, 'new_file', True)
difference = bzip1.compare(NonExistingFile('/nonexisting', bzip1))
assert difference.source2 == '/nonexisting'
+ assert difference.details[-1].source2 == '/dev/null'
diff --git a/tests/comparators/test_fonts.py b/tests/comparators/test_fonts.py
index cd1a536..2bce45a 100644
--- a/tests/comparators/test_fonts.py
+++ b/tests/comparators/test_fonts.py
@@ -57,3 +57,4 @@ def test_compare_non_existing(monkeypatch, ttf1):
monkeypatch.setattr(Config, 'new_file', True)
difference = ttf1.compare(NonExistingFile('/nonexisting', ttf1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/comparators/test_gettext.py b/tests/comparators/test_gettext.py
index e6fa8b7..e592ca6 100644
--- a/tests/comparators/test_gettext.py
+++ b/tests/comparators/test_gettext.py
@@ -72,3 +72,4 @@ def test_compare_non_existing(monkeypatch, mo1):
monkeypatch.setattr(Config, 'new_file', True)
difference = mo1.compare(NonExistingFile('/nonexisting', mo1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/comparators/test_image.py b/tests/comparators/test_image.py
index 4ce1a4a..d48eae3 100644
--- a/tests/comparators/test_image.py
+++ b/tests/comparators/test_image.py
@@ -58,3 +58,4 @@ def test_compare_non_existing(monkeypatch, image1):
monkeypatch.setattr(Config, 'new_file', True)
difference = image1.compare(NonExistingFile('/nonexisting', image1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/comparators/test_java.py b/tests/comparators/test_java.py
index 29f5949..8607881 100644
--- a/tests/comparators/test_java.py
+++ b/tests/comparators/test_java.py
@@ -57,3 +57,4 @@ def test_compare_non_existing(monkeypatch, class1):
monkeypatch.setattr(Config, 'new_file', True)
difference = class1.compare(NonExistingFile('/nonexisting', class1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/comparators/test_macho.py b/tests/comparators/test_macho.py
index f5ec12e..fcd5fcc 100644
--- a/tests/comparators/test_macho.py
+++ b/tests/comparators/test_macho.py
@@ -53,6 +53,7 @@ def test_obj_compare_non_existing(monkeypatch, obj1):
monkeypatch.setattr(Config, 'new_file', True)
difference = obj1.compare(NonExistingFile('/nonexisting', obj1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
@pytest.mark.skipif(tool_missing('otool') or tool_missing('lipo'), reason='missing otool or lipo')
def test_diff(obj_differences):
diff --git a/tests/comparators/test_mono.py b/tests/comparators/test_mono.py
index 08dbe2e..475b2e4 100644
--- a/tests/comparators/test_mono.py
+++ b/tests/comparators/test_mono.py
@@ -62,3 +62,4 @@ def test_compare_non_existing(monkeypatch, exe1):
monkeypatch.setattr(Config, 'new_file', True)
difference = exe1.compare(NonExistingFile('/nonexisting', exe1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/comparators/test_pdf.py b/tests/comparators/test_pdf.py
index 7b4cb21..02ce5eb 100644
--- a/tests/comparators/test_pdf.py
+++ b/tests/comparators/test_pdf.py
@@ -65,3 +65,4 @@ def test_compare_non_existing(monkeypatch, pdf1):
monkeypatch.setattr(Config, 'new_file', True)
difference = pdf1.compare(NonExistingFile('/nonexisting', pdf1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/comparators/test_png.py b/tests/comparators/test_png.py
index 976824e..71e72bc 100644
--- a/tests/comparators/test_png.py
+++ b/tests/comparators/test_png.py
@@ -57,3 +57,4 @@ def test_compare_non_existing(monkeypatch, png1):
monkeypatch.setattr(Config, 'new_file', True)
difference = png1.compare(NonExistingFile('/nonexisting', png1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/comparators/test_ppu.py b/tests/comparators/test_ppu.py
index fe1128c..eca9969 100644
--- a/tests/comparators/test_ppu.py
+++ b/tests/comparators/test_ppu.py
@@ -66,3 +66,4 @@ def test_compare_non_existing(monkeypatch, file1):
monkeypatch.setattr(Config, 'new_file', True)
difference = file1.compare(NonExistingFile('/nonexisting', file1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/comparators/test_sqlite.py b/tests/comparators/test_sqlite.py
index 5ac1c38..de65eb4 100644
--- a/tests/comparators/test_sqlite.py
+++ b/tests/comparators/test_sqlite.py
@@ -57,3 +57,4 @@ def test_compare_non_existing(monkeypatch, sqlite3db1):
monkeypatch.setattr(Config.general, 'new_file', True)
difference = sqlite3db1.compare(NonExistingFile('/nonexisting', sqlite3db1))
assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list