示例#1
0
def test_print_exit_status_errors(caplog):
    """Test that expected error status message is logged."""
    args = Args("Statick tool")
    args.parser.add_argument("--path", help="Path of package to scan")
    statick = Statick(args.get_user_paths())

    statick.print_exit_status(False)
    output = caplog.text.splitlines()[0]
    assert "Statick exiting with errors." in output
示例#2
0
def test_print_exit_status_success(caplog):
    """Test that expected success status message is logged."""
    args = Args("Statick tool")
    args.parser.add_argument("--path", help="Path of package to scan")
    statick = Statick(args.get_user_paths())
    logging.root.setLevel(logging.INFO)

    statick.print_exit_status(True)
    # This should contain logging output but is empty for INFO level.
    output = caplog.text.splitlines()[0]
    assert "Statick exiting with success." in output