From: Afif Elghraoui Date: Thu, 10 Mar 2016 07:35:17 +0000 (-0800) Subject: Fix some failing tests X-Git-Tag: archive/raspbian/0.22.0+ds-1+rpi1~1^2^2~232 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=624c346a131ea1f07dddba8c1d175fd2ec66a9a4;p=python-pysam.git Fix some failing tests These are mostly ones that require network access that are not properly handled. --- diff --git a/debian/patches/compile-test.patch b/debian/patches/compile-test.patch new file mode 100644 index 0000000..d8f1ffc --- /dev/null +++ b/debian/patches/compile-test.patch @@ -0,0 +1,15 @@ +Description: Fix compile-test +Author: Afif Elghraoui +Forwarded: no +Last-Update: 2016-03-09 +--- python-pysam.orig/tests/compile_test.py ++++ python-pysam/tests/compile_test.py +@@ -15,7 +15,7 @@ + + + import pyximport +-pyximport.install(build_in_temp=False) ++pyximport.install(build_in_temp=True) + import _compile_test + + import unittest diff --git a/debian/patches/disable-tests-requiring-network.patch b/debian/patches/disable-tests-requiring-network.patch index b6cf1a1..bc7872d 100644 --- a/debian/patches/disable-tests-requiring-network.patch +++ b/debian/patches/disable-tests-requiring-network.patch @@ -4,7 +4,7 @@ Forwarded: no Last-Update: 2015-11-13 --- python-pysam.orig/tests/tabix_test.py +++ python-pysam/tests/tabix_test.py -@@ -1124,7 +1124,8 @@ +@@ -1124,11 +1124,12 @@ local = os.path.join(DATADIR, "example.gtf.gz") def setUp(self): @@ -14,7 +14,12 @@ Last-Update: 2015-11-13 self.local_file = pysam.TabixFile(self.local, "r") def testFetchAll(self): -@@ -1139,11 +1140,12 @@ +- if not checkURL(self.url): ++ if checkURL(self.url) == False: + return + + remote_result = list(self.remote_file.fetch()) +@@ -1139,14 +1140,15 @@ self.assertEqual(x, y) def testHeader(self): @@ -31,4 +36,54 @@ Last-Update: 2015-11-13 + "header") def tearDown(self): - self.remote_file.close() +- self.remote_file.close() ++# self.remote_file.close() + self.local_file.close() + + +--- python-pysam.orig/tests/AlignmentFile_test.py ++++ python-pysam/tests/AlignmentFile_test.py +@@ -2466,12 +2466,16 @@ + filepath_index=os.path.join(DATADIR, 'ex1.cram.crai')) + + def testRemoteExplicitIndexBAM(self): +- samfile = pysam.AlignmentFile( +- "http://genserv.anat.ox.ac.uk/downloads/pysam/test/noindex.bam", +- "rb", +- filepath_index=os.path.join(DATADIR, 'ex1.bam.bai')) ++ url = "http://genserv.anat.ox.ac.uk/downloads/pysam/test/noindex.bam" ++ if checkURL(url): ++ samfile = pysam.AlignmentFile( ++ url, ++ "rb", ++ filepath_index=os.path.join(DATADIR, 'ex1.bam.bai')) + +- samfile.fetch("chr1") ++ samfile.fetch("chr1") ++ else: ++ pass + + + class TestVerbosity(unittest.TestCase): +--- python-pysam.orig/tests/faidx_test.py ++++ python-pysam/tests/faidx_test.py +@@ -173,12 +173,13 @@ + + + def testFTPView(self): +- if not checkURL(self.url): +- return +- f = pysam.Fastafile(self.url) +- self.assertEqual( +- len(f.fetch("chr1", 0, 1000)), +- 1000) ++ if checkURL(self.url): ++ f = pysam.Fastafile(self.url) ++ self.assertEqual( ++ len(f.fetch("chr1", 0, 1000)), ++ 1000) ++ else: ++ return True + + + if __name__ == "__main__": diff --git a/debian/patches/series b/debian/patches/series index 2e0c2ea..917fbdc 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ external-htslib.patch disable-tests-requiring-network.patch rpath.patch +compile-test.patch