예제 #1
0
def test_parallel_commands__run():
    mocks = []
    for _ in range(3):
        cmd_mock = flexmock(AtomicCmd(["ls"]))
        cmd_mock.should_receive('run').with_args("xTMPx").once
        mocks.append(cmd_mock)

    cmds = ParallelCmds(mocks)
    cmds.run("xTMPx")
예제 #2
0
def test_parallel_commands__run():
    mocks = []
    for _ in range(3):
        cmd_mock = flexmock(AtomicCmd(["ls"]))
        cmd_mock.should_receive('run').with_args("xTMPx").once
        mocks.append(cmd_mock)

    cmds = ParallelCmds(mocks)
    cmds.run("xTMPx")
예제 #3
0
def test_parallel_commands__run():
    mock = Mock()
    cmd_1 = AtomicCmd(["ls"])
    cmd_1.run = mock.run_1
    cmd_2 = AtomicCmd(["ls"])
    cmd_2.run = mock.run_2
    cmd_3 = AtomicCmd(["ls"])
    cmd_3.run = mock.run_3

    cmds = ParallelCmds((cmd_1, cmd_2, cmd_3))
    cmds.run("xTMPx")

    assert mock.mock_calls == [
        call.run_1("xTMPx"),
        call.run_2("xTMPx"),
        call.run_3("xTMPx"),
    ]
예제 #4
0
def test_parallel_commands__join_failure_3(tmp_path):
    mocks = _setup_mocks_for_failure(True, True, False)
    cmds = ParallelCmds(mocks)
    cmds.run(tmp_path)
    assert cmds.join() == ["SIGTERM", "SIGTERM", 1]
예제 #5
0
def test_parallel_commands__join_after_run(tmp_path):
    cmds = ParallelCmds([AtomicCmd("true") for _ in range(3)])
    cmds.run(tmp_path)
    assert cmds.join() == [0, 0, 0]
예제 #6
0
def test_parallel_commands__join_failure_3(temp_folder):
    mocks = _setup_mocks_for_failure(True, True, False)
    cmds = ParallelCmds(mocks)
    cmds.run(temp_folder)
    assert_equal(cmds.join(), ['SIGTERM', 'SIGTERM', 1])
예제 #7
0
def test_parallel_commands__join_after_run(temp_folder):
    cmds = ParallelCmds([AtomicCmd("true") for _ in range(3)])
    cmds.run(temp_folder)
    assert_equal(cmds.join(), [0, 0, 0])
예제 #8
0
def test_parallel_commands__join_failure_3(temp_folder):
    mocks = _setup_mocks_for_failure(True, True, False)
    cmds = ParallelCmds(mocks)
    cmds.run(temp_folder)
    assert_equal(cmds.join(), ['SIGTERM', 'SIGTERM', 1])
예제 #9
0
def test_parallel_commands__join_after_run(temp_folder):
    cmds = ParallelCmds([AtomicCmd("true") for _ in range(3)])
    cmds.run(temp_folder)
    assert_equal(cmds.join(), [0, 0, 0])