當前位置: 首頁>>代碼示例>>Python>>正文


Python CacheManager._prepare_cache_dir方法代碼示例

本文整理匯總了Python中ulif.openoffice.cachemanager.CacheManager._prepare_cache_dir方法的典型用法代碼示例。如果您正苦於以下問題:Python CacheManager._prepare_cache_dir方法的具體用法?Python CacheManager._prepare_cache_dir怎麽用?Python CacheManager._prepare_cache_dir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ulif.openoffice.cachemanager.CacheManager的用法示例。


在下文中一共展示了CacheManager._prepare_cache_dir方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_prepare_cache_dir_broken

# 需要導入模塊: from ulif.openoffice.cachemanager import CacheManager [as 別名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import _prepare_cache_dir [as 別名]
 def test_prepare_cache_dir_broken(self, tmpdir):
     # we fail loudly if we cannot create a cache dir
     cm = CacheManager(str(tmpdir))
     tmpdir.join("not-a-dir.txt").write("foo")     # broken dir
     cm.cache_dir = str(tmpdir / "not-a-dir.txt")
     with pytest.raises(IOError):
         cm._prepare_cache_dir()
開發者ID:sbywater,項目名稱:ulif.openoffice,代碼行數:9,代碼來源:test_cachemanager.py

示例2: test_prepare_cache_dir

# 需要導入模塊: from ulif.openoffice.cachemanager import CacheManager [as 別名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import _prepare_cache_dir [as 別名]
 def test_prepare_cache_dir(self, tmpdir):
     # _prepare_cache_dir creates a cache dir normally
     cm = CacheManager(str(tmpdir.join("cache")))
     new_dir = tmpdir.join("new_dir")
     cm.cache_dir = str(new_dir)
     cm._prepare_cache_dir()
     assert new_dir.isdir() is True
開發者ID:sbywater,項目名稱:ulif.openoffice,代碼行數:9,代碼來源:test_cachemanager.py

示例3: test_prepare_cache_dir

# 需要導入模塊: from ulif.openoffice.cachemanager import CacheManager [as 別名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import _prepare_cache_dir [as 別名]
    def test_prepare_cache_dir(self):
        new_cache_dir = os.path.join(self.workdir, 'newcache')
        broken_cache_dir = os.path.join(self.workdir, 'broken')
        open(broken_cache_dir, 'w').write('broken')
        cm = CacheManager(self.workdir)

        cm.cache_dir = None
        self.assertEqual(cm._prepare_cache_dir(), None)

        cm.cache_dir = new_cache_dir
        cm._prepare_cache_dir()
        self.assertTrue(os.path.isdir(new_cache_dir))

        cm.cache_dir = broken_cache_dir
        self.assertRaises(IOError, cm._prepare_cache_dir)
        return
開發者ID:sennoy,項目名稱:ulif.openoffice,代碼行數:18,代碼來源:test_cachemanager.py

示例4: test_prepare_cache_dir_none

# 需要導入模塊: from ulif.openoffice.cachemanager import CacheManager [as 別名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import _prepare_cache_dir [as 別名]
 def test_prepare_cache_dir_none(self, tmpdir):
     # we can create a cache manager without any cache dir
     cm = CacheManager(str(tmpdir))
     cm.cache_dir = None
     cm._prepare_cache_dir()
     assert cm.cache_dir is None
開發者ID:sbywater,項目名稱:ulif.openoffice,代碼行數:8,代碼來源:test_cachemanager.py


注:本文中的ulif.openoffice.cachemanager.CacheManager._prepare_cache_dir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。