Exemplo n.º 1
0
def test_parallel_commands__join_before_run():
    mocks = []
    for value in reversed(range(3)):
        cmd_mock = flexmock(AtomicCmd("true"))
        cmd_mock.should_receive('join').and_return([value]).never
        mocks.append(cmd_mock)
    cmds = ParallelCmds(mocks)
    assert_equal(cmds.join(), [None, None, None])
Exemplo n.º 2
0
def test_parallel_commands__join_before_run():
    mocks = []
    for value in reversed(range(3)):
        cmd_mock = flexmock(AtomicCmd("true"))
        cmd_mock.should_receive('join').and_return([value]).never
        mocks.append(cmd_mock)
    cmds = ParallelCmds(mocks)
    assert_equal(cmds.join(), [None, None, None])
Exemplo n.º 3
0
def test_parallel_commands__join_before_run():
    mock = Mock()
    cmd_1 = AtomicCmd(["ls"])
    cmd_1.join = mock.join_1
    cmd_2 = AtomicCmd(["ls"])
    cmd_2.join = mock.join_2
    cmd_3 = AtomicCmd(["ls"])
    cmd_3.join = mock.join_3

    cmds = ParallelCmds((cmd_3, cmd_2, cmd_1))
    assert cmds.join() == [None, None, None]

    assert mock.mock_calls == []
Exemplo n.º 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]
Exemplo n.º 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]
Exemplo n.º 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])
Exemplo n.º 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])
Exemplo n.º 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])
Exemplo n.º 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])