Skip to content

Instantly share code, notes, and snippets.

@satyamz
Last active June 26, 2016 09:10
Show Gist options
  • Save satyamz/d1fb6e0c504c4eb767614fdff6ae4202 to your computer and use it in GitHub Desktop.
Save satyamz/d1fb6e0c504c4eb767614fdff6ae4202 to your computer and use it in GitHub Desktop.
This test is checking two `.changes` files having identical fields except `.buildinfo`. It is returning http://paste.debian.net/plain/759295
diff --git a/tests/comparators/test_debian.py b/tests/comparators/test_debian.py
index 627e0af..0561ccf 100644
--- a/tests/comparators/test_debian.py
+++ b/tests/comparators/test_debian.py
@@ -33,6 +33,7 @@ from diffoscope.presenters.text import output_text
TEST_DOT_CHANGES_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.changes')
TEST_DOT_CHANGES_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.changes')
+TEST_DOT_CHANGES_FILE3_PATH = os.path.join(os.path.dirname(__file__), '../data/test3.changes')
TEST_DEB_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.deb')
TEST_DEB_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.deb')
TEST_DOT_BUILDINFO_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.buildinfo')
@@ -56,6 +57,15 @@ def dot_changes2(tmpdir):
shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, str(tmpdir.join('b/test_1.buildinfo')))
return specialize(FilesystemFile(dot_changes_path))
[email protected]
+def dot_changes3(tmpdir):
+ tmpdir.mkdir('c')
+ dot_changes_path = str(tmpdir.join('c/test_1.changes'))
+ shutil.copy(TEST_DOT_CHANGES_FILE3_PATH, dot_changes_path)
+ shutil.copy(TEST_DEB_FILE1_PATH, str(tmpdir.join('c/test_1_all.deb')))
+ shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, str(tmpdir.join('c/test_1.buildinfo')))
+ return specialize(FilesystemFile(dot_changes_path))
+
def test_dot_changes_identification(dot_changes1):
assert isinstance(dot_changes1, DotChangesFile)
@@ -78,6 +88,17 @@ def dot_changes_differences(dot_changes1, dot_changes2):
output_text(difference, print_func=print)
return difference.details
[email protected]
+def dot_changes_differences_ignoring_buildinfo(dot_changes1, dot_changes3):
+ difference = dot_changes1.compare(dot_changes3)
+ output_text(difference, print_func=print)
+ return difference
+
[email protected](miss_debian_module, reason='debian module is not installed')
+def test_ignore_dot_buildinfo_from_dot_changes_compare(dot_changes_differences_ignoring_buildinfo):
+ assert dot_changes_differences_ignoring_buildinfo is None
+
+
@pytest.mark.skipif(miss_debian_module, reason='debian module is not installed')
def test_dot_changes_description(dot_changes_differences):
assert dot_changes_differences[0]
@@ -97,7 +118,7 @@ def test_dot_changes_compare_non_existing(monkeypatch, dot_changes1):
assert difference.details[-1].source2 == '/dev/null'
@pytest.mark.skipif(miss_debian_module, reason='debian module is not installed')
-def test_ignore_dot_buildinfo_from_dot_changes_compare(dot_changes_differences):
+def test_ignore_dot_buildinfo_from_dot_changes_difference(dot_changes_differences):
assert dot_changes_differences[1]
expected_diff = open(os.path.join(os.path.dirname(__file__),
'../data/dot_buildinfo_ignore_from_dot_changes_differences_diff')).read()
diff --git a/tests/data/test3.changes b/tests/data/test3.changes
index e69de29..8e75ce8 100644
--- a/tests/data/test3.changes
+++ b/tests/data/test3.changes
@@ -0,0 +1,25 @@
+Format: 1.8
+Date: Sat, 04 Apr 2015 18:30:48 +0200
+Source: test
+Binary: test
+Architecture: source all
+Version: 1
+Distribution: unstable
+Urgency: low
+Maintainer: Someone Else <[email protected]>
+Changed-By: Someone Else <[email protected]>
+Description:
+ test - just a test package
+Changes:
+ test (1) unstable; urgency=low
+ .
+ * Test package.
+Checksums-Sha1:
+ b21eeec5004853c4955d5b856a6546068c2d7dc9 2262 test_1_all.deb
+ 91d2cc6aadddb4a24b0c2f8f24d558ce0e07f9cd 3765 test_1.buildinfo
+Checksums-Sha256:
+ d2b2ea8b9cf8ef645a328cdb882586ee465e141fc66a2dbe1ad29b29ac1e7920 2262 test_1_all.deb
+ 917d8b5c3ade2bde26fe2b7476481537f32a0c07f10e5e44c0ca7a02c8bfa9d8 3765 test_1.buildinfo
+Files:
+ 660ad4713e5d8271df2e7e86bf246dc0 2262 devel optional test_1_all.deb
+ 9972d7c394228311ba92cbcbfe2d6cd9 3765 web optional test_1.buildinfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment