當前位置: 首頁>>代碼示例>>Python>>正文


Python AtomicCmd.commit方法代碼示例

本文整理匯總了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), [])
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:10,代碼來源:command_test.py

示例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"])
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:13,代碼來源:command_test.py

示例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())
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:21,代碼來源:command_test.py

示例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"))
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:5,代碼來源:node_test.py


注:本文中的paleomix.atomiccmd.command.AtomicCmd.commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。