fix: make ExecutionInfo pass under Bazel 5.4
Bazel 5.4 doesn't support the `exec_group` arg. To fix, don't pass that
arg or assert for it in the tests.
Work towards #11
diff --git a/tests/truth_tests.bzl b/tests/truth_tests.bzl
index b8d31b9..713294d 100644
--- a/tests/truth_tests.bzl
+++ b/tests/truth_tests.bzl
@@ -19,6 +19,8 @@
load("//lib:analysis_test.bzl", "analysis_test", "test_suite")
load("//lib:util.bzl", "util")
+_IS_BAZEL_6_OR_HIGHER = (testing.ExecutionInfo == testing.ExecutionInfo)
+
_suite = []
_TEST_FILES_ATTR = {
@@ -774,7 +776,8 @@
subject = truth.expect(fake_env).that_target(target).provider(testing.ExecutionInfo)
subject.requirements().contains_exactly({"EIKEY1": "EIVALUE1"})
_assert_no_failures(fake_env, env = env)
- subject.exec_group().equals("THE_EXEC_GROUP")
+ if _IS_BAZEL_6_OR_HIGHER:
+ subject.exec_group().equals("THE_EXEC_GROUP")
_assert_no_failures(fake_env, env = env)
_end(env, fake_env)
@@ -1333,6 +1336,11 @@
],
mnemonic = "Action1",
)
+ if _IS_BAZEL_6_OR_HIGHER:
+ exec_info_bazel_6_kwargs = {"exec_group": "THE_EXEC_GROUP"}
+ else:
+ exec_info_bazel_6_kwargs = {}
+
return [
DefaultInfo(
default_runfiles = ctx.runfiles(
@@ -1346,7 +1354,7 @@
environment = {"EKEY1": "EVALUE1", "EKEY2": "EVALUE2"},
inherited_environment = ["INHERIT1", "INHERIT2"],
),
- testing.ExecutionInfo({"EIKEY1": "EIVALUE1"}, exec_group = "THE_EXEC_GROUP"),
+ testing.ExecutionInfo({"EIKEY1": "EIVALUE1"}, **exec_info_bazel_6_kwargs),
OutputGroupInfo(
some_group = depset([_empty_file(ctx, "output_group_file.txt")]),
),