Remove Package#getEvents
It's not actually used anywhere in bazel.
PiperOrigin-RevId: 322166635
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
index 98eec33..acffec6 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
@@ -50,7 +50,6 @@
import com.google.devtools.build.lib.skyframe.util.SkyframeExecutorTestUtils;
import com.google.devtools.build.lib.syntax.Module;
import com.google.devtools.build.lib.testutil.ManualClock;
-import com.google.devtools.build.lib.testutil.MoreAsserts;
import com.google.devtools.build.lib.util.DetailedExitCode;
import com.google.devtools.build.lib.util.ExitCode;
import com.google.devtools.build.lib.util.Pair;
@@ -949,11 +948,9 @@
invalidatePackages();
SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//pkg"));
- Package pkg = validPackage(skyKey);
+ validPackage(skyKey);
- String expectedEventString = "expected boolean for argument `allow_empty`, got `5`";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
- assertContainsEvent(expectedEventString);
+ assertContainsEvent("expected boolean for argument `allow_empty`, got `5`");
}
@Test
@@ -964,7 +961,7 @@
SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//pkg"));
Package pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isFalse();
- assertThat(pkg.getEvents()).isEmpty();
+ assertNoEvents();
}
@Test
@@ -980,7 +977,7 @@
SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//pkg"));
Package pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isFalse();
- assertThat(pkg.getEvents()).isEmpty();
+ assertNoEvents();
}
@Test
@@ -993,7 +990,7 @@
Package pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isFalse();
- assertThat(pkg.getEvents()).isEmpty();
+ assertNoEvents();
scratch.deleteFile("pkg/blah.foo");
getSkyframeExecutor()
@@ -1005,11 +1002,9 @@
reporter.removeHandler(failFastHandler);
pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isTrue();
- String expectedEventString =
+ assertContainsEvent(
"glob pattern '*.foo' didn't match anything, but allow_empty is set to False (the "
- + "default value of allow_empty can be set with --incompatible_disallow_empty_glob).";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
- assertContainsEvent(expectedEventString);
+ + "default value of allow_empty can be set with --incompatible_disallow_empty_glob).");
}
@Test
@@ -1027,7 +1022,7 @@
Package pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isFalse();
- assertThat(pkg.getEvents()).isEmpty();
+ assertNoEvents();
scratch.deleteFile("pkg/blah.foo");
getSkyframeExecutor()
@@ -1039,11 +1034,9 @@
reporter.removeHandler(failFastHandler);
pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isTrue();
- String expectedEventString =
+ assertContainsEvent(
"glob pattern '*.foo' didn't match anything, but allow_empty is set to False (the "
- + "default value of allow_empty can be set with --incompatible_disallow_empty_glob).";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
- assertContainsEvent(expectedEventString);
+ + "default value of allow_empty can be set with --incompatible_disallow_empty_glob).");
}
@Test
@@ -1059,7 +1052,6 @@
String expectedEventString =
"glob pattern '*.foo' didn't match anything, but allow_empty is set to False (the "
+ "default value of allow_empty can be set with --incompatible_disallow_empty_glob).";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
assertContainsEvent(expectedEventString);
scratch.overwriteFile("pkg/BUILD", "x = " + "glob(['*.foo'], allow_empty=False) #comment");
@@ -1071,7 +1063,6 @@
pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isTrue();
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
assertContainsEvent(expectedEventString);
}
@@ -1093,7 +1084,6 @@
String expectedEventString =
"glob pattern '*.foo' didn't match anything, but allow_empty is set to False (the "
+ "default value of allow_empty can be set with --incompatible_disallow_empty_glob).";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
assertContainsEvent(expectedEventString);
scratch.overwriteFile("pkg/BUILD", "x = " + "glob(['*.foo']) #comment");
@@ -1105,7 +1095,6 @@
pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isTrue();
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
assertContainsEvent(expectedEventString);
}
@@ -1124,7 +1113,6 @@
String expectedEventString =
"all files in the glob have been excluded, but allow_empty is set to False (the "
+ "default value of allow_empty can be set with --incompatible_disallow_empty_glob).";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
assertContainsEvent(expectedEventString);
scratch.overwriteFile(
@@ -1138,7 +1126,6 @@
pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isTrue();
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
assertContainsEvent(expectedEventString);
}
@@ -1162,7 +1149,6 @@
String expectedEventString =
"all files in the glob have been excluded, but allow_empty is set to False (the "
+ "default value of allow_empty can be set with --incompatible_disallow_empty_glob).";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
assertContainsEvent(expectedEventString);
scratch.overwriteFile("pkg/BUILD", "x = glob(include=['*.foo'], exclude=['blah.*']) # comment");
@@ -1174,7 +1160,6 @@
pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isTrue();
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
assertContainsEvent(expectedEventString);
}
@@ -1188,11 +1173,9 @@
reporter.removeHandler(failFastHandler);
Package pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isTrue();
- String expectedEventString =
+ assertContainsEvent(
"glob pattern '*.foo' didn't match anything, but allow_empty is set to False (the "
- + "default value of allow_empty can be set with --incompatible_disallow_empty_glob).";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
- assertContainsEvent(expectedEventString);
+ + "default value of allow_empty can be set with --incompatible_disallow_empty_glob).");
scratch.file("pkg/blah.foo");
getSkyframeExecutor()
@@ -1202,9 +1185,10 @@
Root.fromPath(rootDirectory));
reporter.addHandler(failFastHandler);
+ eventCollector.clear();
pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isFalse();
- assertThat(pkg.getEvents()).isEmpty();
+ assertNoEvents();
}
@Test
@@ -1222,11 +1206,10 @@
reporter.removeHandler(failFastHandler);
Package pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isTrue();
- String expectedEventString =
+
+ assertContainsEvent(
"glob pattern '*.foo' didn't match anything, but allow_empty is set to False (the "
- + "default value of allow_empty can be set with --incompatible_disallow_empty_glob).";
- MoreAsserts.assertContainsEvent(pkg.getEvents(), expectedEventString);
- assertContainsEvent(expectedEventString);
+ + "default value of allow_empty can be set with --incompatible_disallow_empty_glob).");
scratch.file("pkg/blah.foo");
getSkyframeExecutor()
@@ -1236,9 +1219,10 @@
Root.fromPath(rootDirectory));
reporter.addHandler(failFastHandler);
+ eventCollector.clear();
pkg = validPackage(skyKey);
assertThat(pkg.containsErrors()).isFalse();
- assertThat(pkg.getEvents()).isEmpty();
+ assertNoEvents();
}
@Test