You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for the Debian package of Pysam, we need to skip tests requiring network, since it is unavailable by design in some of our build farm. Would you like to provide such an offline facility in Pysam ?
Here is how I would do on one file (inspired by bits and pieces saw on StackOverflow).
--- a/tests/pysam_test.py+++ b/tests/pysam_test.py@@ -7,6 +7,7 @@ and data files located there.
import pysam
import unittest
+import urllib2
import os
import shutil
import sys
@@ -21,6 +22,12 @@ SAMTOOLS = "samtools"
WORKDIR = "pysam_test_work"
DATADIR = "pysam_data"
+def internet_on():+ try:+ response=urllib2.urlopen('http://ftp.1000genomes.ebi.ac.uk',timeout=1)+ return True+ except urllib2.URLError as err: pass+ return False
class BasicTestBAMFetch(unittest.TestCase):
@@ -973,6 +980,8 @@ class TestHeaderFromRefs(unittest.TestCase):
class TestHeader1000Genomes(unittest.TestCase):
'''see issue 110'''
+ if internet_on() == False:+ self.skipTest('Internet access required for this test')
# bamfile = "http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/phase2b_alignment/data/NA07048/exome_alignment/NA07048.unmapped.ILLUMINA.bwa.CEU.exome.20120522_p2b.bam"
bamfile = "http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/phase3_EX_or_LC_only_alignment/data/HG00104/alignment/HG00104.chrom11.ILLUMINA.bwa.GBR.low_coverage.20130415.bam"
However, multiple files have tests requiring the network. Is there a better solution than cut-and-paste?
Have a nice day,
Charles
The text was updated successfully, but these errors were encountered:
Dear Andreas,
for the Debian package of Pysam, we need to skip tests requiring network, since it is unavailable by design in some of our build farm. Would you like to provide such an offline facility in Pysam ?
Here is how I would do on one file (inspired by bits and pieces saw on StackOverflow).
However, multiple files have tests requiring the network. Is there a better solution than cut-and-paste?
Have a nice day,
Charles
The text was updated successfully, but these errors were encountered: