utility method TestModeFlags.runWithFlag, reset flags at the test end

GitOrigin-RevId: 0614d45dd075aa9f0edb7d436df4bfd42074ddba
This commit is contained in:
Alexey Kudravtsev
2025-04-22 13:00:39 +00:00
committed by intellij-monorepo-bot
parent 4d298d267e
commit 8fd9522f2d
@@ -304,14 +304,7 @@ abstract class CommonJavaTargetTestBase(protected val executionMode: ExecutionMo
}
private fun runWithConnectInUnitTestMode(block: () -> Unit) {
val connectInUnitTestModeValue = TestModeFlags.get(SearchForTestsTask.CONNECT_IN_UNIT_TEST_MODE_PROPERTY_KEY)
TestModeFlags.set(SearchForTestsTask.CONNECT_IN_UNIT_TEST_MODE_PROPERTY_KEY, true)
try {
block()
}
finally {
TestModeFlags.set(SearchForTestsTask.CONNECT_IN_UNIT_TEST_MODE_PROPERTY_KEY, connectInUnitTestModeValue)
}
TestModeFlags.runWithFlag(SearchForTestsTask.CONNECT_IN_UNIT_TEST_MODE_PROPERTY_KEY, true, block)
}
/**