Beispiel #1
0
def test_call_command_failure(command_instance, mocker):
    executor = mocker.patch(
        "django_codemod.cli.parallel_exec_transform_with_prettyprint")
    executor.return_value = ParallelTransformResult(successes=0,
                                                    failures=1,
                                                    warnings=0,
                                                    skips=0)

    with pytest.raises(click.exceptions.Exit):
        call_command(command_instance, ".")
Beispiel #2
0
def test_call_command_interrupted(command_instance, mocker):
    executor = mocker.patch(
        "django_codemod.cli.parallel_exec_transform_with_prettyprint",
        side_effect=KeyboardInterrupt(),
    )
    executor.return_value = ParallelTransformResult(successes=1,
                                                    failures=0,
                                                    warnings=0,
                                                    skips=0)

    with pytest.raises(click.Abort):
        call_command(command_instance, ".")
Beispiel #3
0
def test_call_command_success(command_instance, mocker):
    executor = mocker.patch(
        "django_codemod.cli.parallel_exec_transform_with_prettyprint")
    executor.return_value = ParallelTransformResult(successes=1,
                                                    failures=0,
                                                    warnings=0,
                                                    skips=0)

    result = call_command(command_instance, ".")

    assert result is None