def METHOD_NAME(
    rundb_mock, packager: str, expected_result: bool, is_mandatory: bool
):
    """
    Test the custom packagers collection from a project during the `look_for_context` method.
    :param rundb_mock:      A runDB mock fixture.
    :param packager:        The custom packager to collect.
    :param expected_result: Whether the packager collection should succeed.
    :param is_mandatory:    If the packager is mandatory for the run or not. Mandatory packagers will always raise
                            exception if they couldn't be collected.
    """
    project = mlrun.get_or_create_project(name="default")
    project.add_custom_packager(
        packager=packager,
        is_mandatory=is_mandatory,
    )
    project.save_to_db()
    mlrun_function = project.set_function(
        func=__file__, name="test_custom_packagers", image="mlrun/mlrun"
    )
    if expected_result or not is_mandatory:
        mlrun_function.run(handler="collect_custom_packagers", local=True)
        return
    try:
        mlrun_function.run(handler="collect_custom_packagers", local=True)
        assert False
    except RunError:
        pass