def setup(self,**kwargs): self.tempdir = self.tempDirClass(**kwargs) from pygr.downloader import SourceURL try: s = SourceURL('http://www.doe-mbi.ucla.edu/~leec/test.gz') except socket.gaierror: raise nose.SkipTest s.__doc__ = 'test download' import pygr.Data pygr.Data.Bio.Test.Download1 = s pygr.Data.save() self.tempdir.force_reload()
def test_download(self): "Downloading of gzipped file using pygr.Data" url = SourceURL('http://www.doe-mbi.ucla.edu/~leec/test.gz') url.__doc__ = 'test download' worldbase.add_resource('Bio.Test.Download1', url) worldbase.commit() # performs the download fpath = worldbase.Bio.Test.Download1() h = testutil.get_file_md5(fpath) self.assertEqual(h.hexdigest(), 'f95656496c5182d6cff9a56153c9db73') os.remove(fpath)
def test_download(self): "Downloading of gzipped file using pygr.Data" url = SourceURL('http://www.doe-mbi.ucla.edu/~leec/test.gz') url.__doc__ = 'test download' pygr.Data.addResource('Bio.Test.Download1', url) pygr.Data.save() # performs the download fpath = pygr.Data.Bio.Test.Download1() h = testutil.get_file_md5(fpath) self.assertEqual(h.hexdigest(), 'f95656496c5182d6cff9a56153c9db73') os.remove(fpath)
def test_download(self): "Downloading of gzipped file using metabase" url = SourceURL("http://www.doe-mbi.ucla.edu/~leec/test.gz") url.__doc__ = "test download" self.metabase.add_resource("Bio.Test.Download1", url) self.metabase.commit() # performs the download fpath = self.pygrData.Bio.Test.Download1() h = testutil.get_file_md5(fpath) self.assertEqual(h.hexdigest(), "f95656496c5182d6cff9a56153c9db73") os.remove(fpath)
def create_downloadable_resource(url, mdb, name, doc): dfile = SourceURL(url) nbuilder = NLMSABuilder(dfile) nbuilder.__doc__ = doc mdb.add_resource(name, nbuilder) mdb.commit()