Example #1
0
def test_task_run(runtime):
    DummyTask._run_task = Mock()
    multi_cmd = cci.RunTaskCommand()
    cmd = multi_cmd.get_command(Mock, "dummy-task")

    run_click_command(cmd, "dummy-task", color="blue", runtime=runtime)

    DummyTask._run_task.assert_called_once()
Example #2
0
def test_task_run__debug_after(runtime):
    DummyTask._run_task = Mock()
    multi_cmd = cci.RunTaskCommand()

    set_trace = Mock(side_effect=SetTrace)
    with patch("pdb.set_trace", set_trace):
        with pytest.raises(SetTrace):
            cmd = multi_cmd.get_command(Mock(), "dummy-task")
            run_click_command(
                cmd,
                "dummy-task",
                color="blue",
                debug_before=False,
                debug_after=True,
                runtime=runtime,
            )
Example #3
0
def test_task_run__list_commands(runtime):
    multi_cmd = cci.RunTaskCommand()
    commands = multi_cmd.list_commands(Mock())
    assert commands == ["dummy-derived-task", "dummy-task"]
Example #4
0
def test_task_run__no_project(runtime):
    runtime.project_config = None
    runtime.project_config_error = Exception("Broken")
    with pytest.raises(Exception, match="Broken"):
        cci.RunTaskCommand().get_command(Mock, "dummy-task")