def METHOD_NAME(test, args, mocker):
    m = mocker.patch(
        "model_archiver.model_packaging.ArgParser.export_model_args_parser",
    )
    m.return_value.parse_args.return_value = args
    mocker.patch("sys.exit", side_effect=Exception())
    from model_archiver.model_packaging import generate_model_archive
    it = test.get("iterations", 1)
    for i in range(it):
        try:
            generate_model_archive()
        except Exception as exc:
            if test.get("expect-error") is not True:
                assert 0, str(exc)
            else:
                return 0
    # In case we expect an error we should not be here
    if test.get("expect-error") is True:
        assert 0, f"Error expected in test: {test['name']}"
    return 1