mirror of
https://github.com/biopython/biopython.git
synced 2025-10-20 13:43:47 +08:00
Don't use urlopen in a with...as statement.
The urllib2.urlopen function under Python 2 does not return an object which can be used as a context manager (no __enter__ or __exit__ methods).
This commit is contained in:
committed by
Peter Cock
parent
4a4e755b87
commit
2a94b05706
@ -279,9 +279,10 @@ class TestGckWithDGVC(unittest.TestCase):
|
||||
return
|
||||
|
||||
try:
|
||||
with urlopen('https://emb.carnegiescience.edu/sites/default/files/DGVC_GCK.zip') as response:
|
||||
with open('Gck/DGVC_GCK.zip', 'wb') as f:
|
||||
shutil.copyfileobj(response, f)
|
||||
src = urlopen('https://emb.carnegiescience.edu/sites/default/files/DGVC_GCK.zip')
|
||||
with open('Gck/DGVC_GCK.zip', 'wb') as dst:
|
||||
shutil.copyfileobj(src, dst)
|
||||
src.close()
|
||||
except HTTPError:
|
||||
self.skipTest("Cannot download the sample files")
|
||||
return
|
||||
|
Reference in New Issue
Block a user