本文整理匯總了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"))