本文整理汇总了Python中paleomix.atomiccmd.command.AtomicCmd.commit方法的典型用法代码示例。如果您正苦于以下问题:Python AtomicCmd.commit方法的具体用法?Python AtomicCmd.commit怎么用?Python AtomicCmd.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paleomix.atomiccmd.command.AtomicCmd
的用法示例。
在下文中一共展示了AtomicCmd.commit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_atomiccmd__commit_temp_only
# 需要导入模块: from paleomix.atomiccmd.command import AtomicCmd [as 别名]
# 或者: from paleomix.atomiccmd.command.AtomicCmd import commit [as 别名]
def test_atomiccmd__commit_temp_only(temp_folder):
cmd = AtomicCmd(("echo", "foo"),
TEMP_OUT_STDOUT="bar.txt")
cmd.run(temp_folder)
assert_equal(cmd.join(), [0])
assert os.path.exists(os.path.join(temp_folder, "bar.txt"))
cmd.commit(temp_folder)
assert_equal(os.listdir(temp_folder), [])
示例2: test_atomiccmd__commit_temp_out
# 需要导入模块: from paleomix.atomiccmd.command import AtomicCmd [as 别名]
# 或者: from paleomix.atomiccmd.command.AtomicCmd import commit [as 别名]
def test_atomiccmd__commit_temp_out(temp_folder):
dest, temp = _setup_for_commit(temp_folder, create_cmd=False)
cmd = AtomicCmd(("echo", "foo"),
OUT_STDOUT=os.path.join(dest, "foo.txt"),
TEMP_OUT_FOO="bar.txt")
cmd.run(temp)
assert_equal(cmd.join(), [0])
set_file_contents(os.path.join(temp, "bar.txt"), "1 2 3")
cmd.commit(temp)
assert_equal(os.listdir(temp), [])
assert_equal(os.listdir(dest), ["foo.txt"])
示例3: test_atomiccmd__commit_with_pipes
# 需要导入模块: from paleomix.atomiccmd.command import AtomicCmd [as 别名]
# 或者: from paleomix.atomiccmd.command.AtomicCmd import commit [as 别名]
def test_atomiccmd__commit_with_pipes(temp_folder):
destination, temp_folder = _setup_for_commit(temp_folder, False)
command_1 = AtomicCmd(("echo", "Hello, World!"),
OUT_STDOUT=AtomicCmd.PIPE)
command_2 = AtomicCmd(("gzip",),
IN_STDIN=command_1,
OUT_STDOUT=os.path.join(destination, "foo.gz"))
command_1.run(temp_folder)
command_2.run(temp_folder)
assert_equal(command_1.join(), [0])
assert_equal(command_2.join(), [0])
command_1.commit(temp_folder)
command_2.commit(temp_folder)
assert_equal(set(os.listdir(destination)), set(("foo.gz",)))
assert_equal(set(os.listdir(temp_folder)), set())
示例4: commit
# 需要导入模块: from paleomix.atomiccmd.command import AtomicCmd [as 别名]
# 或者: from paleomix.atomiccmd.command.AtomicCmd import commit [as 别名]
def commit(self, temp):
AtomicCmd.commit(self, temp)
os.remove(os.path.join(destination, "foo.txt"))