def test_nbd_not_loaded(self):
tempdir = self.useFixture(fixtures.TempDir()).path
n = nbd.NbdMount(self.file, tempdir)
# Fake out os.path.exists
def fake_exists(path):
if path.startswith('/sys/block/nbd'):
return False
return ORIG_EXISTS(path)
self.useFixture(fixtures.MonkeyPatch('os.path.exists', fake_exists))
# This should fail, as we don't have the module "loaded"
# TODO(mikal): work out how to force english as the gettext language
# so that the error check always passes
self.assertIsNone(n._allocate_nbd())
self.assertEqual('nbd unavailable: module not loaded', n.error)
test_nbd.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录