本文整理汇总了Python中apache.aurora.executor.common.sandbox.DirectorySandbox.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python DirectorySandbox.destroy方法的具体用法?Python DirectorySandbox.destroy怎么用?Python DirectorySandbox.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apache.aurora.executor.common.sandbox.DirectorySandbox
的用法示例。
在下文中一共展示了DirectorySandbox.destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_destroy_ioerror
# 需要导入模块: from apache.aurora.executor.common.sandbox import DirectorySandbox [as 别名]
# 或者: from apache.aurora.executor.common.sandbox.DirectorySandbox import destroy [as 别名]
def test_destroy_ioerror():
with temporary_dir() as d:
ds = DirectorySandbox(d)
ds.create()
with mock.patch('shutil.rmtree') as shutil_rmtree:
shutil_rmtree.side_effect = IOError('What even are you doing?')
with pytest.raises(DirectorySandbox.DeletionError):
ds.destroy()
示例2: test_destroy_ioerror
# 需要导入模块: from apache.aurora.executor.common.sandbox import DirectorySandbox [as 别名]
# 或者: from apache.aurora.executor.common.sandbox.DirectorySandbox import destroy [as 别名]
def test_destroy_ioerror():
with temporary_dir() as d:
real_path = os.path.join(d, "sandbox")
ds = DirectorySandbox(real_path)
ds.create()
with mock.patch("shutil.rmtree") as shutil_rmtree:
shutil_rmtree.side_effect = IOError("What even are you doing?")
with pytest.raises(DirectorySandbox.DeletionError):
ds.destroy()
示例3: test_directory_sandbox
# 需要导入模块: from apache.aurora.executor.common.sandbox import DirectorySandbox [as 别名]
# 或者: from apache.aurora.executor.common.sandbox.DirectorySandbox import destroy [as 别名]
def test_directory_sandbox():
with temporary_dir() as d:
ds1 = DirectorySandbox(os.path.join(d, 'task1'))
ds2 = DirectorySandbox(os.path.join(d, 'task2'))
ds1.create()
ds2.create()
assert os.path.exists(ds1.root)
assert os.path.exists(ds2.root)
ds1.destroy()
assert not os.path.exists(ds1.root)
assert os.path.exists(ds2.root)
ds2.destroy()
assert not os.path.exists(ds2.root)