本文整理汇总了Python中ulif.openoffice.cachemanager.CacheManager.cache_dir方法的典型用法代码示例。如果您正苦于以下问题:Python CacheManager.cache_dir方法的具体用法?Python CacheManager.cache_dir怎么用?Python CacheManager.cache_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ulif.openoffice.cachemanager.CacheManager
的用法示例。
在下文中一共展示了CacheManager.cache_dir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_prepare_cache_dir
# 需要导入模块: from ulif.openoffice.cachemanager import CacheManager [as 别名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import 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, 'wb').write('broken')
cm = CacheManager(self.workdir)
cm.cache_dir = None
self.assertEqual(cm.prepareCacheDir(), None)
cm.cache_dir = new_cache_dir
cm.prepareCacheDir()
self.assertTrue(os.path.isdir(new_cache_dir))
cm.cache_dir = broken_cache_dir
self.assertRaises(IOError, cm.prepareCacheDir)
return
示例2: test_prepare_cache_dir_broken
# 需要导入模块: from ulif.openoffice.cachemanager import CacheManager [as 别名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import 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()
示例3: test_prepare_cache_dir
# 需要导入模块: from ulif.openoffice.cachemanager import CacheManager [as 别名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import 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
示例4: test_prepare_cache_dir_none
# 需要导入模块: from ulif.openoffice.cachemanager import CacheManager [as 别名]
# 或者: from ulif.openoffice.cachemanager.CacheManager import 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