Skip to content

Commit f5d01c7

Browse files
authored
test: use a custom rule instead of native.filegroup for testing that PyInfo is a required provider. (bazel-contrib#1479)
Within Google, for historical reasons, the filegroup rule type is allowed in deps, which means `test_requires_pyinfo` test fails. This can be easily worked around by using a custom rule that doesn't have the same name.
1 parent 38b5ac0 commit f5d01c7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/base_rules/base_tests.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ _produces_py_info = rule(
3030
attrs = {"srcs": attr.label_list(allow_files = True)},
3131
)
3232

33+
def _not_produces_py_info_impl(ctx):
34+
_ = ctx # @unused
35+
return [DefaultInfo()]
36+
37+
_not_produces_py_info = rule(
38+
implementation = _not_produces_py_info_impl,
39+
)
40+
3341
def _test_consumes_provider(name, config):
3442
rt_util.helper_target(
3543
config.base_test_rule,
@@ -62,7 +70,7 @@ def _test_requires_provider(name, config):
6270
deps = [name + "_nopyinfo"],
6371
)
6472
rt_util.helper_target(
65-
native.filegroup,
73+
_not_produces_py_info,
6674
name = name + "_nopyinfo",
6775
)
6876
analysis_test(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy