Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

run_tests.py doesn't see these MissingExternalDependencyError excepti…

…ons so not skipped

The MissingExternalDependencyError should be raised at import time
in order that run_tests.py can skip the unit test. Removing the
try/except as it was hiding the underlying network error, e.g.
HTTPError: HTTP Error 502: Bad Gateway

We might want to add a quick check to see if the NCBI Entrez site
is live at the start of test_SeqIO_online.py instead...
  • Loading branch information...
commit 9cd69af10275ab80c9542574754de802cb8a05c7 1 parent 6745ce8
@peterjc peterjc authored
Showing with 9 additions and 19 deletions.
  1. +9 −19 Tests/test_SeqIO_online.py
View
28 Tests/test_SeqIO_online.py
@@ -18,8 +18,6 @@
import requires_internet
requires_internet.check()
-from Bio import MissingExternalDependencyError
-
#We want to test these:
from Bio import Entrez
from Bio import ExPASy
@@ -41,16 +39,12 @@ class ExPASyTests(unittest.TestCase):
def test_get_sprot_raw(self):
"""Bio.ExPASy.get_sprot_raw("O23729")"""
identifier = "O23729"
- try:
- #This is to catch an error page from our proxy:
- handle = UndoHandle(ExPASy.get_sprot_raw(identifier))
- if _as_string(handle.peekline()).startswith("<!DOCTYPE HTML"):
- raise IOError
- record = SeqIO.read(handle, "swiss")
- handle.close()
- except IOError:
- raise MissingExternalDependencyError(
- "internet (or maybe just ExPASy) not available")
+ #This is to catch an error page from our proxy:
+ handle = UndoHandle(ExPASy.get_sprot_raw(identifier))
+ if _as_string(handle.peekline()).startswith("<!DOCTYPE HTML"):
+ raise IOError
+ record = SeqIO.read(handle, "swiss")
+ handle.close()
self.assertEqual(record.id, identifier)
self.assertEqual(len(record), 394)
self.assertEqual(seguid(record.seq), "5Y08l+HJRDIlhLKzFEfkcKd1dkM")
@@ -59,13 +53,9 @@ def test_get_sprot_raw(self):
class EntrezTests(unittest.TestCase):
def simple(self, database, formats, entry, length, checksum):
for f in formats:
- try:
- handle = Entrez.efetch(db=database, id=entry, rettype=f, retmode="text")
- record = SeqIO.read(handle, f)
- handle.close()
- except IOError:
- raise MissingExternalDependencyError(
- "internet (or maybe just NCBI) not available")
+ handle = Entrez.efetch(db=database, id=entry, rettype=f, retmode="text")
+ record = SeqIO.read(handle, f)
+ handle.close()
self.assertTrue((entry in record.name) or
(entry in record.id) or
("gi" in record.annotations
Please sign in to comment.
Something went wrong with that request. Please try again.