def _is_test_bundle_with_provider(target, deps, bundle_provider):
    """Determines whether the target is a test bundle target that provides the specified bundle provider.

    Apple test bundle targets will provide a test bundle provider and will have
    a single dep that also provides the provider.

    Args:
        target: The `Target` to evaluate.
        deps: The `list` of dependencies for the target as returned by
            `ctx.rule.attr.deps`.
        bundle_provider: A bundle provider type (e.g
            `IosXcTestBundleInfo`, `MacosXcTestBundleInfo`).

    Returns:
        A `bool` indicating whether the target is a test bundle provider of the
        specified provider.
    """
    return (
        bundle_provider in target and
        len(deps) == 1 and
        bundle_provider in deps[0]
    )