From: Michael R. Crusoe Date: Wed, 20 Feb 2019 08:38:20 +0000 (-0800) Subject: cope with change to Tabix index format X-Git-Tag: archive/raspbian/0.22.0+ds-1+rpi1~1^2^2~92 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=09438982e1cf86c0d4b7e8aa4815ad6fad7e0305;p=python-pysam.git cope with change to Tabix index format --- diff --git a/debian/changelog b/debian/changelog index 1d5eaad..9aaaff1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-pysam (0.15.2+ds-2) UNRELEASED; urgency=medium + + * Team upload. + * For the Tabix tests: test the index contents, not the compression scheme. + Closes: #919928, #920250 + + -- Michael R. Crusoe Wed, 20 Feb 2019 01:34:19 -0800 + python-pysam (0.15.2+ds-1) unstable; urgency=medium * Team upload. diff --git a/debian/patches/series b/debian/patches/series index d87fe71..b6c4823 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ skip_test_remote.patch skip_test_needing_missing_data.patch spelling +test_index_not_compression diff --git a/debian/patches/test_index_not_compression b/debian/patches/test_index_not_compression new file mode 100644 index 0000000..b5ca774 --- /dev/null +++ b/debian/patches/test_index_not_compression @@ -0,0 +1,70 @@ +From: Michael R. Crusoe +Subject: Test Tabix index contents, not the compression + +Fixes: https://github.com/samtools/htslib/issues/827 + +--- python-pysam.orig/tests/tabix_test.py ++++ python-pysam/tests/tabix_test.py +@@ -14,8 +14,6 @@ + import subprocess + import glob + import re +-import copy +-import tempfile + from TestUtils import check_url, load_and_convert, TABIX_DATADIR, get_temp_filename + + IS_PYTHON3 = sys.version_info[0] >= 3 +@@ -64,6 +62,17 @@ + return found + + ++def checkGZBinaryEqual(filename1, filename2): ++ '''return true if the two files are binary equal.''' ++ with gzip.open(filename1, "rb") as infile1: ++ d1 = infile1.read() ++ with gzip.open(filename2, "rb") as infile2: ++ d2 = infile2.read() ++ if d1 == d2: ++ return True ++ return False ++ ++ + class TestIndexing(unittest.TestCase): + filename = os.path.join(TABIX_DATADIR, "example.gtf.gz") + filename_idx = os.path.join(TABIX_DATADIR, "example.gtf.gz.tbi") +@@ -77,7 +86,7 @@ + '''test indexing via preset.''' + + pysam.tabix_index(self.tmpfilename, preset="gff") +- self.assertTrue(checkBinaryEqual( ++ self.assertTrue(checkGZBinaryEqual( + self.tmpfilename + ".tbi", self.filename_idx)) + + def test_indexing_to_custom_location_works(self): +@@ -86,7 +95,7 @@ + index_path = get_temp_filename(suffix='custom.tbi') + pysam.tabix_index(self.tmpfilename, preset="gff", + index=index_path, force=True) +- self.assertTrue(checkBinaryEqual(index_path, self.filename_idx)) ++ self.assertTrue(checkGZBinaryEqual(index_path, self.filename_idx)) + os.unlink(index_path) + + def test_indexing_with_explict_columns_works(self): +@@ -98,7 +107,7 @@ + end_col=4, + line_skip=0, + zerobased=False) +- self.assertTrue(checkBinaryEqual( ++ self.assertTrue(checkGZBinaryEqual( + self.tmpfilename + ".tbi", self.filename_idx)) + + def test_indexing_with_lineskipping_works(self): +@@ -109,7 +118,7 @@ + end_col=4, + line_skip=1, + zerobased=False) +- self.assertFalse(checkBinaryEqual( ++ self.assertFalse(checkGZBinaryEqual( + self.tmpfilename + ".tbi", self.filename_idx)) + + def tearDown(self):