Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5913816

Browse filesBrowse files
authored
tests: make some tests compatible with Bazel 9 fix various tests relying on Bazel builtin providers existing (bazel-contrib#2433)
In Bazel 9, the builtin symbols don't exist. This fixes some tests that fail when those symbols are missing.
1 parent fe3f7a4 commit 5913816
Copy full SHA for 5913816

File tree

4 files changed

+12
-4
lines changed
Filter options

4 files changed

+12
-4
lines changed

‎tests/base_rules/base_tests.bzl

Copy file name to clipboardExpand all lines: tests/base_rules/base_tests.bzl
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ _produces_builtin_py_info = rule(
4343
)
4444

4545
def _produces_py_info_impl(ctx):
46-
return _create_py_info(ctx, BuiltinPyInfo)
46+
return _create_py_info(ctx, PyInfo)
4747

4848
_produces_py_info = rule(
4949
implementation = _produces_py_info_impl,
@@ -86,6 +86,9 @@ def _py_info_propagation_test_impl(env, target, provider_type):
8686
info.imports().contains("custom-import")
8787

8888
def _test_py_info_propagation_builtin(name, config):
89+
if not BuiltinPyInfo:
90+
rt_util.skip_test(name = name)
91+
return
8992
_py_info_propagation_setup(
9093
name,
9194
config,

‎tests/base_rules/py_info/py_info_tests.bzl

Copy file name to clipboardExpand all lines: tests/base_rules/py_info/py_info_tests.bzl
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _provide_py_info_impl(ctx):
3939
providers.append(PyInfo(**kwargs))
4040

4141
# Handle Bazel 6 or if Bazel autoloading is enabled
42-
if not config.enable_pystar or PyInfo != BuiltinPyInfo:
42+
if not config.enable_pystar or (BuiltinPyInfo and PyInfo != BuiltinPyInfo):
4343
providers.append(BuiltinPyInfo(**{
4444
k: kwargs[k]
4545
for k in (

‎tests/config_settings/transition/multi_version_tests.bzl

Copy file name to clipboardExpand all lines: tests/config_settings/transition/multi_version_tests.bzl
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def _test_py_test_with_transition(name):
4949
def _test_py_test_with_transition_impl(env, target):
5050
# Nothing to assert; we just want to make sure it builds
5151
env.expect.that_target(target).has_provider(PyInfo)
52-
env.expect.that_target(target).has_provider(BuiltinPyInfo)
52+
if BuiltinPyInfo:
53+
env.expect.that_target(target).has_provider(BuiltinPyInfo)
5354

5455
_tests.append(_test_py_test_with_transition)
5556

@@ -70,7 +71,8 @@ def _test_py_binary_with_transition(name):
7071
def _test_py_binary_with_transition_impl(env, target):
7172
# Nothing to assert; we just want to make sure it builds
7273
env.expect.that_target(target).has_provider(PyInfo)
73-
env.expect.that_target(target).has_provider(BuiltinPyInfo)
74+
if BuiltinPyInfo:
75+
env.expect.that_target(target).has_provider(BuiltinPyInfo)
7476

7577
_tests.append(_test_py_binary_with_transition)
7678

‎tests/py_runtime_pair/py_runtime_pair_tests.bzl

Copy file name to clipboardExpand all lines: tests/py_runtime_pair/py_runtime_pair_tests.bzl
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def _test_basic_impl(env, target):
7676
_tests.append(_test_basic)
7777

7878
def _test_builtin_py_info_accepted(name):
79+
if not BuiltinPyRuntimeInfo:
80+
rt_util.skip_test(name = name)
81+
return
7982
rt_util.helper_target(
8083
_provides_builtin_py_runtime_info,
8184
name = name + "_runtime",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.