Ejemplo n.º 1
0
def test_ufodiff_commandline_deltamd_exit_success(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "deltamd", "all", "commits:2"]
        main()

    out, err = capsys.readouterr()
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
Ejemplo n.º 2
0
def test_ufodiff_commandline_diffnc_success_git_arg(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "diffnc", "HEAD~1"]
        main()

    out, err = capsys.readouterr()
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
Ejemplo n.º 3
0
def test_ufodiff_commandline_delta_commits_number_with_ufo_filter(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "delta", "all", "commits:1", "Test-Regular.ufo"]
        main()

    out, err = capsys.readouterr()
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
Ejemplo n.º 4
0
def test_ufodiff_commandline_diffnc_exception_git_request(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "diffnc", "bogus"]
        main()

    out, err = capsys.readouterr()
    assert err.startswith("[ufodiff] ERROR: ")
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 1
Ejemplo n.º 5
0
def test_ufodiff_commandline_diff_missing_branch(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "diff", "branch:"]
        main()

    out, err = capsys.readouterr()
    assert err.startswith("[ufodiff] ERROR:")
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 1
Ejemplo n.º 6
0
def test_ufodiff_commandline_delta_commits_number_is_lessthan_zero(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "delta", "all", "commits:-1"]
        main()

    out, err = capsys.readouterr()
    assert err.startswith("[ufodiff] ERROR:")
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 1
Ejemplo n.º 7
0
def test_ufodiff_commandline_delta_unacceptable_subsub(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "delta", "bogus", "commits:1"]
        main()

    out, err = capsys.readouterr()
    assert err.startswith("[ufodiff] ERROR:")
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 1
Ejemplo n.º 8
0
def test_ufodiff_commandline_missingargs(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff"]
        main()

    out, err = capsys.readouterr()
    assert err.startswith(
        "[ufodiff] ERROR: Please include the appropriate arguments")
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 1
Ejemplo n.º 9
0
def test_ufodiff_commandline_longusage(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main
        from ufodiff.app import settings

        sys.argv = ["ufodiff", "--usage"]
        main()

    out, err = capsys.readouterr()
    assert out.startswith(settings.USAGE)
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
Ejemplo n.º 10
0
def test_ufodiff_commandline_shortversion(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main
        from ufodiff.app import settings

        sys.argv = ["ufodiff", "-v"]
        main()

    out, err = capsys.readouterr()
    assert out.startswith(settings.VERSION)
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
Ejemplo n.º 11
0
def test_ufodiff_commandline_longhelp(capsys):
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "--help"]
        main()

    out, err = capsys.readouterr()
    assert (
        out.startswith("====================================================")
        is True)
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
Ejemplo n.º 12
0
def test_ufodiff_commandline_delta_git_root_check_three_levels_below(capsys):
    the_cwd = os.getcwd()
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "delta", "all", "commits:1"]
        os.chdir(os.path.join(the_cwd, "tests", "testfiles", "depth2"))
        main()

    out, err = capsys.readouterr()
    os.chdir(the_cwd)
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
Ejemplo n.º 13
0
def test_ufodiff_commandline_diffnc_success_branch_arg(capsys):
    make_testing_branch()

    with pytest.raises(SystemExit) as pytest_wrapped_e:
        from ufodiff.app import main

        sys.argv = ["ufodiff", "diffnc", "branch:testing_branch"]
        main()

    out, err = capsys.readouterr()
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0

    delete_testing_branch()