Exemple #1
0
 def _add_to_cache(self, url, cache):
     path = utils.get_path_from_url(url, ensure_file=False)
     if not utils.is_local(url):
         path = os.path.join(self.context.cache_dir,
                             utils.get_filename_from_uri(path))
         self.context.connection.retrieve(url, path)
     cache[url] = path
Exemple #2
0
 def _add_to_cache(self, url, cache):
     path = utils.get_path_from_url(url, ensure_file=False)
     if not utils.is_local(url):
         path = os.path.join(
             self.context.cache_dir, utils.get_filename_from_uri(path)
         )
         self.context.connection.retrieve(url, path)
     cache[url] = path
 def test_is_local(self):
     self.assertTrue(utils.is_local("/root/1.txt"))
     self.assertTrue(utils.is_local("file:///root/1.txt"))
     self.assertTrue(utils.is_local("./root/1.txt"))
     self.assertFalse(utils.is_local("http://localhost/root/1.txt"))
Exemple #4
0
 def test_is_local(self):
     self.assertTrue(utils.is_local("/root/1.txt"))
     self.assertTrue(utils.is_local("file:///root/1.txt"))
     self.assertTrue(utils.is_local("./root/1.txt"))
     self.assertFalse(utils.is_local("http://localhost/root/1.txt"))