[plugin tests] simplification: clear errors in PluginSetTestBuilder instead of doing it in individual tests

(cherry picked from commit b2c50cb2a03136e960b1184c1ed26657f207c162)

IJ-CR-166252

GitOrigin-RevId: c027ac65c5d079f6bdde0a9dc1d785e3bce36899
This commit is contained in:
Nikolay Chashnikov
2025-06-19 09:21:58 +02:00
committed by intellij-monorepo-bot
parent 4aa0af0eac
commit 0f5ea36f4e
6 changed files with 5 additions and 7 deletions

View File

@@ -1050,8 +1050,6 @@ class DynamicPluginsTest {
@Test
@TestFor(issues = ["IJPL-183884"])
fun `initial loading errors are cleared after successful dynamic plugin loading`() {
PluginManagerCore.getAndClearPluginLoadingErrors() // clear errors which may be registered by other tests
val barPluginPath = pluginsDir.resolve("bar")
val fooPluginPath = pluginsDir.resolve("foo")

View File

@@ -136,7 +136,6 @@ internal class PluginDependenciesTest {
@Test
fun `plugin is not loaded if required module is not available`() {
PluginManagerCore.getAndClearPluginLoadingErrors() //clear errors which may be registered by other tests
plugin("sample.plugin") {
content {
module("required.module", ModuleLoadingRule.REQUIRED) {
@@ -207,7 +206,6 @@ internal class PluginDependenciesTest {
@Test
fun `required content module with unresolved dependency in the core plugin`() {
PluginManagerCore.getAndClearPluginLoadingErrors() //clear errors which may be registered by other tests
val corePluginDir = pluginDirPath.resolve("core")
plugin(PluginManagerCore.CORE_PLUGIN_ID) {
content {

View File

@@ -217,7 +217,6 @@ class PluginSetLoadingTest {
@Test
fun `package prefix collision prevents plugin from loading`() {
PluginManagerCore.getAndClearPluginLoadingErrors()
// FIXME these plugins are not related, but one of them loads => depends on implicit order
plugin("foo") {
content {
@@ -255,7 +254,6 @@ class PluginSetLoadingTest {
@Test
fun `package prefix collision prevents plugin from loading - same plugin`() {
PluginManagerCore.getAndClearPluginLoadingErrors()
plugin("foo") {
packagePrefix = "common.module"
content {
@@ -271,7 +269,6 @@ class PluginSetLoadingTest {
@Test
fun `package prefix collision does not prevent plugin from loading if module is optional`() {
PluginManagerCore.getAndClearPluginLoadingErrors()
plugin("foo") {
content {
module("foo.module", loadingRule = ModuleLoadingRule.OPTIONAL) { packagePrefix = "common.module" }

View File

@@ -9,6 +9,7 @@ jvm_library(
deps = [
"@lib//:kotlin-stdlib",
"@lib//:jetbrains-annotations",
"//platform/util",
"//platform/core-api:core",
"//platform/core-impl",
"//platform/util-class-loader:util-classLoader",

View File

@@ -9,6 +9,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="library" name="jetbrains-annotations" level="project" />
<orderEntry type="module" module-name="intellij.platform.util" />
<orderEntry type="module" module-name="intellij.platform.core" />
<orderEntry type="module" module-name="intellij.platform.core.impl" />
<orderEntry type="module" module-name="intellij.platform.util.classLoader" />

View File

@@ -101,6 +101,9 @@ class PluginSetTestBuilder private constructor(
}
fun build(): PluginSet {
//clear errors, which may be registered by other tests
PluginManagerCore.getAndClearPluginLoadingErrors()
val initContext = buildInitContext()
val (loadingContext, loadingResult) = buildLoadingResult(initContext)
return PluginManagerCore.initializePlugins(