[med-svn] [python-pysam] 01/03: Exclude tests trying to access remote http sites and thus need to fail in a chroot without network access.

Andreas Tille tille at debian.org
Thu Dec 14 16:36:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository python-pysam.

commit 7d7ef289574c104103b9795f82605e399bdd1a1e
Author: Andreas Tille <tille at debian.org>
Date:   Thu Dec 14 16:35:40 2017 +0100

    Exclude tests trying to access remote http sites and thus need to fail in a chroot without network access.
---
 .../exclude_tests_accessing_remote_http.patch      | 225 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 226 insertions(+)

diff --git a/debian/patches/exclude_tests_accessing_remote_http.patch b/debian/patches/exclude_tests_accessing_remote_http.patch
new file mode 100644
index 0000000..1377946
--- /dev/null
+++ b/debian/patches/exclude_tests_accessing_remote_http.patch
@@ -0,0 +1,225 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Wed, 13 Dec 2017 13:03:50 +0100
+Description: Exclude tests trying to access remote http sites and thus need
+ to fail in a chroot without network access.
+ .
+ Remark: Any more elegant method than dumb removal to exclude the tests would
+ be welcome.
+
+--- a/save/pysam_test2.6.py
++++ b/save/pysam_test2.6.py
+@@ -1284,61 +1284,6 @@ class TestDoubleFetch(unittest.TestCase)
+                        samfile1.fetch( until_eof = True )):
+             self.assertEqual( a.compare( b), 0 )
+ 
+-class TestRemoteFileFTP(unittest.TestCase):
+-    '''test remote access.
+-
+-    '''
+-
+-    # Need to find an ftp server without password on standard
+-    # port.
+-
+-    url = "ftp://ftp.sanger.ac.uk/pub/rd/humanSequences/CV.bam"
+-    region = "1:1-1000"
+-
+-    def testFTPView( self ):
+-        return
+-        result = pysam.view( self.url, self.region )
+-        self.assertEqual( len(result), 36 )
+-        
+-    def testFTPFetch( self ):
+-        return
+-        samfile = pysam.Samfile(self.url, "rb")  
+-        result = list(samfile.fetch( region = self.region ))
+-        self.assertEqual( len(result), 36 )
+-
+-class TestRemoteFileHTTP( unittest.TestCase):
+-
+-    url = "http://genserv.anat.ox.ac.uk/downloads/pysam/test/ex1.bam"
+-    region = "chr1:1-1000"
+-    local = "ex1.bam"
+-
+-    def testView( self ):
+-        samfile_local = pysam.Samfile(self.local, "rb")  
+-        ref = list(samfile_local.fetch( region = self.region ))
+-        
+-        result = pysam.view( self.url, self.region )
+-        self.assertEqual( len(result), len(ref) )
+-        
+-    def testFetch( self ):
+-        samfile = pysam.Samfile(self.url, "rb")  
+-        result = list(samfile.fetch( region = self.region ))
+-        samfile_local = pysam.Samfile(self.local, "rb")  
+-        ref = list(samfile_local.fetch( region = self.region ))
+-
+-        self.assertEqual( len(ref), len(result) )
+-        for x, y in zip(result, ref):
+-            self.assertEqual( x.compare( y ), 0 )
+-
+-    def testFetchAll( self ):
+-        samfile = pysam.Samfile(self.url, "rb")  
+-        result = list(samfile.fetch())
+-        samfile_local = pysam.Samfile(self.local, "rb")  
+-        ref = list(samfile_local.fetch() )
+-
+-        self.assertEqual( len(ref), len(result) )
+-        for x, y in zip(result, ref):
+-            self.assertEqual( x.compare( y ), 0 )
+-
+ class TestLargeOptValues( unittest.TestCase ):
+ 
+     ints = ( 65536, 214748, 2147484, 2147483647 )
+--- a/tests/AlignmentFile_test.py
++++ b/tests/AlignmentFile_test.py
+@@ -1893,81 +1893,6 @@ class TestDoubleFetchCRAMWithReference(T
+     reference_filename = os.path.join(BAM_DATADIR, 'ex1.fa')
+ 
+ 
+-class TestRemoteFileFTP(unittest.TestCase):
+-
+-    '''test remote access.
+-
+-    '''
+-
+-    # Need to find an ftp server without password on standard
+-    # port.
+-
+-    url = "ftp://ftp.sanger.ac.uk/pub/rd/humanSequences/CV.bam"
+-    region = "1:1-1000"
+-
+-    def testFTPView(self):
+-        return
+-        if not checkURL(self.url):
+-            return
+-
+-        result = pysam.samtools.view(self.url, self.region)
+-        self.assertEqual(len(result), 36)
+-
+-    def testFTPFetch(self):
+-        return
+-        if not checkURL(self.url):
+-            return
+-
+-        samfile = pysam.AlignmentFile(self.url, "rb")
+-        result = list(samfile.fetch(region=self.region))
+-        self.assertEqual(len(result), 36)
+-
+-
+-class TestRemoteFileHTTP(unittest.TestCase):
+-
+-    url = "http://genserv.anat.ox.ac.uk/downloads/pysam/test/ex1.bam"
+-    region = "chr1:1-1000"
+-    local = os.path.join(BAM_DATADIR, "ex1.bam")
+-
+-    def testView(self):
+-        if not checkURL(self.url):
+-            return
+-
+-        samfile_local = pysam.AlignmentFile(self.local, "rb")
+-        ref = list(samfile_local.fetch(region=self.region))
+-
+-        result = pysam.samtools.view(self.url, self.region)
+-        self.assertEqual(len(result.splitlines()), len(ref))
+-
+-    def testFetch(self):
+-        if not checkURL(self.url):
+-            return
+-
+-        with pysam.AlignmentFile(self.url, "rb") as samfile:
+-            result = list(samfile.fetch(region=self.region))
+-
+-        with pysam.AlignmentFile(self.local, "rb") as samfile_local:
+-            ref = list(samfile_local.fetch(region=self.region))
+-
+-        self.assertEqual(len(ref), len(result))
+-        for x, y in zip(result, ref):
+-            self.assertEqual(x.compare(y), 0)
+-
+-    def testFetchAll(self):
+-        if not checkURL(self.url):
+-            return
+-
+-        with pysam.AlignmentFile(self.url, "rb") as samfile:
+-            result = list(samfile.fetch())
+-
+-        with pysam.AlignmentFile(self.local, "rb") as samfile_local:
+-            ref = list(samfile_local.fetch())
+-
+-        self.assertEqual(len(ref), len(result))
+-        for x, y in zip(result, ref):
+-            self.assertEqual(x.compare(y), 0)
+-
+-
+ class TestLargeOptValues(unittest.TestCase):
+ 
+     ints = (65536, 214748, 2147484, 2147483647)
+--- a/tests/tabix_test.py
++++ b/tests/tabix_test.py
+@@ -1033,66 +1033,6 @@ for vcf_file in vcf_files:
+     globals()[n] = type(n, (TestVCFFromVariantFile,), dict(filename=vcf_file,))
+ 
+ 
+-class TestRemoteFileHTTP(unittest.TestCase):
+-
+-    url = "http://www.cgat.org/downloads/public/pysam/test/example.gtf.gz"
+-    region = "chr1:1-1000"
+-    local = os.path.join(TABIX_DATADIR, "example.gtf.gz")
+-
+-    def setUp(self):
+-        if not pysam.config.HAVE_LIBCURL or not checkURL(self.url):
+-            self.remote_file = None
+-        else:
+-            self.remote_file = pysam.TabixFile(self.url, "r")
+-            
+-        self.local_file = pysam.TabixFile(self.local, "r")
+-
+-    def tearDown(self):
+-        if self.remote_file is None:
+-            return
+-
+-        self.remote_file.close()
+-        self.local_file.close()
+-
+-    def testFetchAll(self):
+-        if self.remote_file is None:
+-            return
+-
+-        remote_result = list(self.remote_file.fetch())
+-        local_result = list(self.local_file.fetch())
+-
+-        self.assertEqual(len(remote_result), len(local_result))
+-        for x, y in zip(remote_result, local_result):
+-            self.assertEqual(x, y)
+-
+-    def testHeader(self):
+-        if self.remote_file is None:
+-            return
+-
+-        self.assertEqual(list(self.local_file.header), [])
+-
+-
+-class TestRemoteFileHTTPWithHeader(TestRemoteFileHTTP):
+-
+-    url = "http://www.cgat.org/downloads/public/pysam/test/example_comments.gtf.gz"
+-    region = "chr1:1-1000"
+-    local = os.path.join(TABIX_DATADIR, "example_comments.gtf.gz")
+-
+-    def setUp(self):
+-        if not pysam.config.HAVE_LIBCURL or not checkURL(self.url):
+-            self.remote_file = None
+-        else:
+-            self.remote_file = pysam.TabixFile(self.url, "r")
+-        self.local_file = pysam.TabixFile(self.local, "r")
+-
+-    def testHeader(self):
+-        if self.remote_file is None:
+-            return
+-
+-        self.assertEqual(list(self.local_file.header), ["# comment at start"])
+-        self.assertEqual(list(self.local_file.header), self.remote_file.header)
+-        
+-
+ class TestIndexArgument(unittest.TestCase):
+ 
+     filename_src = os.path.join(TABIX_DATADIR, "example.vcf.gz")
diff --git a/debian/patches/series b/debian/patches/series
index c2c2f28..4d62d6e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 execute-linking-tests-only-when-explicitely-reque.patch
 xfail.patch
+exclude_tests_accessing_remote_http.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-pysam.git



More information about the debian-med-commit mailing list