コード例 #1
0
 def test_set_cache_root(self):
     orig_root = download.get_cache_root()
     new_root = "/tmp/cache"
     try:
         download.set_cache_root(new_root)
         self.assertEqual(download.get_cache_root(), new_root)
     finally:
         download.set_cache_root(orig_root)
コード例 #2
0
 def setUp(self):
     self.default_cache_root = download.get_cache_root()
     self.temp_dir = tempfile.mkdtemp()
     download.set_cache_root(self.temp_dir)
コード例 #3
0
 def test_get_cache_directory(self):
     root = download.get_cache_root()
     path = download.get_cache_directory("test", False)
     self.assertEqual(path, os.path.join(root, "test"))