Skip to content

Instantly share code, notes, and snippets.

@satyamz
Last active June 25, 2016 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satyamz/051df1f8d48207bfc319b8feb8b6ee74 to your computer and use it in GitHub Desktop.
Save satyamz/051df1f8d48207bfc319b8feb8b6ee74 to your computer and use it in GitHub Desktop.
Diff of test for ignoring .buildinfo file from .changes differences
diff --git a/tests/comparators/test_debian.py b/tests/comparators/test_debian.py
index 86e70c2..d9396e1 100644
--- a/tests/comparators/test_debian.py
+++ b/tests/comparators/test_debian.py
@@ -35,6 +35,8 @@ TEST_DOT_CHANGES_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/t
TEST_DOT_CHANGES_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.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')
+TEST_DOT_BUILDINFO_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.buildinfo')
@pytest.fixture
def dot_changes1(tmpdir):
@@ -42,6 +44,7 @@ def dot_changes1(tmpdir):
dot_changes_path = str(tmpdir.join('a/test_1.changes'))
shutil.copy(TEST_DOT_CHANGES_FILE1_PATH, dot_changes_path)
shutil.copy(TEST_DEB_FILE1_PATH, str(tmpdir.join('a/test_1_all.deb')))
+ shutil.copy(TEST_DOT_BUILDINFO_FILE1_PATH, str(tmpdir.join('a/test_1.buildinfo')))
return specialize(FilesystemFile(dot_changes_path))
@pytest.fixture
@@ -50,6 +53,7 @@ def dot_changes2(tmpdir):
dot_changes_path = str(tmpdir.join('b/test_1.changes'))
shutil.copy(TEST_DOT_CHANGES_FILE2_PATH, dot_changes_path)
shutil.copy(TEST_DEB_FILE2_PATH, str(tmpdir.join('b/test_1_all.deb')))
+ shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, str(tmpdir.join('b/test_1.buildinfo')))
return specialize(FilesystemFile(dot_changes_path))
def test_dot_changes_identification(dot_changes1):
@@ -92,6 +96,12 @@ def test_dot_changes_compare_non_existing(monkeypatch, dot_changes1):
assert difference.source2 == '/nonexisting'
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):
+ 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()
+ assert dot_changes_differences[1].unified_diff == expected_diff
+
TEST_DOT_DSC_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.dsc')
TEST_DOT_DSC_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.dsc')
@pytest.fixture
@@ -50,6 +53,7 @@ def dot_changes2(tmpdir):
dot_changes_path = str(tmpdir.join('b/test_1.changes'))
shutil.copy(TEST_DOT_CHANGES_FILE2_PATH, dot_changes_path)
shutil.copy(TEST_DEB_FILE2_PATH, str(tmpdir.join('b/test_1_all.deb')))
+ shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, str(tmpdir.join('b/test_1.buildinfo')))
return specialize(FilesystemFile(dot_changes_path))
def test_dot_changes_identification(dot_changes1):
@@ -92,6 +96,12 @@ def test_dot_changes_compare_non_existing(monkeypatch, dot_changes1):
assert difference.source2 == '/nonexisting'
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):
+ assert dot_changes_differences[1]
+ expected_diff = open(os.path.join(os.path.dirname(__file__), '../data/dot_buildinfo_ignore_from_dot_changes_differences_diff')).re
ad()
+ assert dot_changes_differences[1].unified_diff == expected_diff
+
TEST_DOT_DSC_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.dsc')
TEST_DOT_DSC_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.dsc')
TEST_DEB_SRC1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.debsrc.tar.gz')
@@ -147,8 +157,6 @@ def test_dot_dsc_compare_non_existing(monkeypatch, dot_dsc1):
assert difference.source2 == '/nonexisting'
assert difference.details[-1].source2 == '/dev/null'
-TEST_DOT_BUILDINFO_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.buildinfo')
-TEST_DOT_BUILDINFO_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.buildinfo')
@pytest.fixture
def dot_buildinfo1(tmpdir):
diff --git a/tests/data/test1.changes b/tests/data/test1.changes
index b32e971..624556e 100644
--- a/tests/data/test1.changes
+++ b/tests/data/test1.changes
@@ -16,7 +16,10 @@ Changes:
* Test package.
Checksums-Sha1:
b21eeec5004853c4955d5b856a6546068c2d7dc9 2262 test_1_all.deb
+ e1cafb5f8db51f4ec477807d105b1e3cccf9a767 3780 test_1.buildinfo
Checksums-Sha256:
d2b2ea8b9cf8ef645a328cdb882586ee465e141fc66a2dbe1ad29b29ac1e7920 2262 test_1_all.deb
+ 167d989223978a45a69af30dcd488baa00aec2045b66d0f74d7f03b08fd22365 3780 test_1.buildinfo
Files:
660ad4713e5d8271df2e7e86bf246dc0 2262 devel optional test_1_all.deb
+ 40756b7e8aae2c1fcbcac099670b6db8 3780 web optional test_1.buildinfo
diff --git a/tests/data/test2.changes b/tests/data/test2.changes
index 3e33d3a..1bc7ec6 100644
--- a/tests/data/test2.changes
+++ b/tests/data/test2.changes
@@ -16,7 +16,10 @@ Changes:
* Test package.
Checksums-Sha1:
70982664db2015334bff6441b429d7e3c58dbecb 2388 test_1_all.deb
+ 91d2cc6aadddb4a24b0c2f8f24d558ce0e07f9cd 3765 test_1.buildinfo
Checksums-Sha256:
2f2e45ee3a5fdacd9b30133ec728121588bf9b97af3b947b3882b2b28a0555da 2388 test_1_all.deb
+ 917d8b5c3ade2bde26fe2b7476481537f32a0c07f10e5e44c0ca7a02c8bfa9d8 3765 test_1.buildinfo
Files:
d323c454462407fe3bfde31a74b23eba 2388 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