def test_atomiccmd__ready(tmp_path): cmd = AtomicCmd("ls") assert cmd.join() == [None] assert not cmd.ready() cmd.run(tmp_path) assert cmd.join() == [0] assert cmd.ready()
def test_atomiccmd__ready(temp_folder): cmd = AtomicCmd("ls") assert_equal(cmd.join(), [None]) assert not cmd.ready() cmd.run(temp_folder) assert_equal(cmd.join(), [0]) assert cmd.ready()
def test_parallel_commands__ready_two(first, second, result): cmd_1 = AtomicCmd(["ls"]) cmd_1.ready = Mock() cmd_1.ready.return_value = first cmd_2 = AtomicCmd(["ls"]) cmd_2.ready = Mock() cmd_2.ready.return_value = second cmds = ParallelCmds([cmd_1, cmd_2]) assert cmds.ready() == result cmd_1.ready.assert_called() assert bool(first) == bool(cmd_2.ready.call_count)
def test_parallel_commands__ready_single(value): cmd = AtomicCmd(["ls"]) cmd.ready = Mock() cmd.ready.return_value = value cmds = ParallelCmds([cmd]) assert cmds.ready() == value cmd.ready.assert_called()