Properly teardown test methods

Moves `super.tearDown` into a finally clause such that it gets executed even when an exception is thrown before it gets called.

GitOrigin-RevId: 51b257ada3a916ec5a8462445e67db50c86852bb
This commit is contained in:
Bart van Helvert
2022-06-15 17:44:16 +00:00
committed by intellij-monorepo-bot
parent c8b55bb5de
commit 970ff60e8e
79 changed files with 802 additions and 491 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.compiler.artifacts.workspaceModel
import com.intellij.compiler.artifacts.ArtifactsTestCase
@@ -41,7 +41,6 @@ import com.intellij.workspaceModel.storage.bridgeEntities.api.ArtifactProperties
import com.intellij.workspaceModel.storage.bridgeEntities.api.ArtifactRootElementEntity
import com.intellij.workspaceModel.storage.url.VirtualFileUrlManager
import junit.framework.TestCase
import com.intellij.workspaceModel.storage.bridgeEntities.api.modifyEntity
import org.junit.Assume.assumeTrue
import org.junit.runner.RunWith
import java.util.concurrent.Callable
@@ -50,8 +49,15 @@ import java.util.concurrent.Callable
class ArtifactTest : ArtifactsTestCase() {
override fun tearDown() {
ArtifactsTestingState.reset()
super.tearDown()
try {
ArtifactsTestingState.reset()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun `test rename artifact via model`() = runWriteAction {
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.roots.ui.configuration.classpath
import com.intellij.openapi.application.WriteAction
@@ -15,8 +15,15 @@ import junit.framework.TestCase
class InlineModuleDependencyActionTest : JavaModuleTestCase() {
override fun tearDown() {
ProjectStructureConfigurable.getInstance(myProject).context.modulesConfigurator.disposeUIResources()
super.tearDown()
try {
ProjectStructureConfigurable.getInstance(myProject).context.modulesConfigurator.disposeUIResources()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun `test inline module with module library`() {
@@ -1,9 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.roots.ui.configuration.libraryEditor
import com.intellij.ide.highlighter.ArchiveFileType
import com.intellij.openapi.fileTypes.FileTypeRegistry
import com.intellij.openapi.fileTypes.StdFileTypes
import com.intellij.openapi.progress.EmptyProgressIndicator
import com.intellij.openapi.roots.NativeLibraryOrderRootType
import com.intellij.openapi.roots.OrderRootType
@@ -89,7 +88,14 @@ class JavaLibraryRootsDetectionTest : LightPlatformTestCase() {
}
override fun tearDown() {
JarFileSystemImpl.cleanupForNextTest()
super.tearDown()
try {
JarFileSystemImpl.cleanupForNextTest()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.roots.ui.configuration.projectRoot
import com.intellij.openapi.vfs.JarFileSystem
@@ -79,7 +65,14 @@ class ConvertToRepositoryLibraryActionTest : LightPlatformTestCase() {
}
override fun tearDown() {
JarFileSystemImpl.cleanupForNextTest()
super.tearDown()
try {
JarFileSystemImpl.cleanupForNextTest()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeInsight;
import com.intellij.codeInsight.AutoPopupController;
@@ -38,8 +38,15 @@ public abstract class AbstractParameterInfoTestCase extends LightFixtureCompleti
@Override
protected void tearDown() throws Exception {
CodeInsightSettings.getInstance().PARAMETER_INFO_DELAY = myStoredAutoPopupDelay;
super.tearDown();
try {
CodeInsightSettings.getInstance().PARAMETER_INFO_DELAY = myStoredAutoPopupDelay;
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
protected void configureJava(String text) {
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeInsight.daemon.inlays
import com.intellij.codeInsight.hints.settings.ParameterNameHintsSettings
@@ -21,10 +21,16 @@ class BlackListMethodIntentionTest : LightJavaCodeInsightFixtureTestCase() {
}
override fun tearDown() {
EditorSettingsExternalizable.getInstance().isShowParameterNameHints = isParamHintsEnabledBefore
ParameterNameHintsSettings.getInstance().loadState(default.state)
super.tearDown()
try {
EditorSettingsExternalizable.getInstance().isShowParameterNameHints = isParamHintsEnabledBefore
ParameterNameHintsSettings.getInstance().loadState(default.state)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun `test add to blacklist by alt enter`() {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeInsight.daemon.inlays
import com.intellij.codeInsight.daemon.impl.ParameterHintsPresentationManager
@@ -33,9 +19,16 @@ class JavaInlayParameterHintsTest : LightJavaCodeInsightFixtureTestCase() {
}
override fun tearDown() {
val default = ParameterNameHintsSettings()
ParameterNameHintsSettings.getInstance().loadState(default.state)
super.tearDown()
try {
val default = ParameterNameHintsSettings()
ParameterNameHintsSettings.getInstance().loadState(default.state)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun check(text: String) {
@@ -28,8 +28,15 @@ internal abstract class ProjectProblemsViewTest : LightJavaCodeInsightFixtureTes
}
override fun tearDown() {
project.putUserData(CodeVisionHost.isCodeVisionTestKey, null)
super.tearDown()
try {
project.putUserData(CodeVisionHost.isCodeVisionTestKey, null)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
override fun getProjectDescriptor(): LightProjectDescriptor {
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeInsight.daemon.problems
import com.intellij.codeInsight.codeVision.CodeVisionHost
@@ -33,8 +33,15 @@ internal class SplitEditorProblemsTest : ProjectProblemsViewTest() {
}
override fun tearDown() {
project.putUserData(CodeVisionHost.isCodeVisionTestKey, null)
super.tearDown()
try {
project.putUserData(CodeVisionHost.isCodeVisionTestKey, null)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun testClassRenameInTwoDetachedWindows() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeInsight.daemon.quickFix;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
@@ -34,9 +34,16 @@ public class I18nQuickFixTest extends LightQuickFixParameterizedTestCase {
@Override
protected void tearDown() throws Exception {
// avoid "memory/disk conflict" when the document for changed annotation.xml stays in memory
((PsiDocumentManagerBase)PsiDocumentManager.getInstance(getProject())).clearUncommittedDocuments();
super.tearDown();
try {
// avoid "memory/disk conflict" when the document for changed annotation.xml stays in memory
((PsiDocumentManagerBase)PsiDocumentManager.getInstance(getProject())).clearUncommittedDocuments();
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
@Override
@@ -24,11 +24,18 @@ public class NestedClassLineMarkerTest extends LightJavaCodeInsightFixtureTestCa
private final Set<RunnerAndConfigurationSettings> myTempSettings = new HashSet<>();
@Override
protected void tearDown() throws Exception {
RunManager runManager = RunManager.getInstance(getProject());
for (RunnerAndConfigurationSettings setting : myTempSettings) {
runManager.removeConfiguration(setting);
try {
RunManager runManager = RunManager.getInstance(getProject());
for (RunnerAndConfigurationSettings setting : myTempSettings) {
runManager.removeConfiguration(setting);
}
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
super.tearDown();
}
@Override
@@ -47,11 +47,18 @@ public class RunLineMarkerTest extends LightJavaCodeInsightFixtureTestCase {
private final Set<RunnerAndConfigurationSettings> myTempSettings = new HashSet<>();
@Override
protected void tearDown() throws Exception {
RunManager runManager = RunManager.getInstance(getProject());
for (RunnerAndConfigurationSettings setting : myTempSettings) {
runManager.removeConfiguration(setting);
try {
RunManager runManager = RunManager.getInstance(getProject());
for (RunnerAndConfigurationSettings setting : myTempSettings) {
runManager.removeConfiguration(setting);
}
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
super.tearDown();
}
public void testRunLineMarker() {
@@ -29,10 +29,17 @@ class InspectionResultViewTest : LightJava9ModulesCodeInsightFixtureTestCase() {
}
public override fun tearDown() {
GlobalInspectionContextImpl.TESTING_VIEW = false
InspectionProfileImpl.INIT_INSPECTIONS = false
AnalysisUIOptions.getInstance(project).SHOW_STRUCTURE = myDefaultShowStructure
super.tearDown()
try {
GlobalInspectionContextImpl.TESTING_VIEW = false
InspectionProfileImpl.INIT_INSPECTIONS = false
AnalysisUIOptions.getInstance(project).SHOW_STRUCTURE = myDefaultShowStructure
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun testModuleInfoProblemsTree() {
@@ -32,9 +32,15 @@ internal class FileTemplatesTest : JavaProjectTestCase() {
private var testConfigDir: Path? = null
override fun tearDown() {
super.tearDown()
testConfigDir?.delete()
try {
testConfigDir?.delete()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun testAllTemplates() {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.psi.codeStyle
@@ -40,9 +26,15 @@ class IndentOptionsCacheDropTest: LightJavaCodeInsightFixtureTestCase() {
}
override fun tearDown() {
val instance = DetectableIndentOptionsProvider.getInstance()
instance?.setEnabledInTest(false)
super.tearDown()
try {
DetectableIndentOptionsProvider.getInstance()?.setEnabledInTest(false)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
val code = """
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.refactoring
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
@@ -297,9 +297,15 @@ class ExtractMethodAndDuplicatesInplaceTest: LightJavaCodeInsightTestCase() {
}
override fun tearDown() {
val template = getActiveTemplate()
if (template != null) Disposer.dispose(template)
super.tearDown()
try {
val template = getActiveTemplate()
if (template != null) Disposer.dispose(template)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.refactoring;
import com.intellij.openapi.editor.Editor;
@@ -21,8 +21,15 @@ public class InplaceIntroduceConstantTest extends AbstractJavaInplaceIntroduceTe
@Override
protected void tearDown() throws Exception {
super.tearDown();
JavaRefactoringSettings.getInstance().INTRODUCE_CONSTANT_REPLACE_ALL = false;
try {
JavaRefactoringSettings.getInstance().INTRODUCE_CONSTANT_REPLACE_ALL = false;
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public void testReplaceAll() {
@@ -18,8 +18,15 @@ abstract class LightJava9ModulesCodeInsightFixtureTestCase : LightJavaCodeInsigh
override fun getProjectDescriptor(): LightProjectDescriptor = MultiModuleJava9ProjectDescriptor
override fun tearDown() {
super.tearDown()
MultiModuleJava9ProjectDescriptor.cleanupSourceRoots()
try {
MultiModuleJava9ProjectDescriptor.cleanupSourceRoots()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
protected fun addFile(path: String, text: String, module: ModuleDescriptor = MAIN): VirtualFile =
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.command.undo;
import com.intellij.codeWithMe.ClientId;
@@ -40,8 +40,15 @@ public class MultiUserEditorUndoTest extends EditorUndoTestCase {
@Override
protected void tearDown() throws Exception {
Disposer.dispose(myDisposable);
super.tearDown();
try {
Disposer.dispose(myDisposable);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public void testUndoSimpleCommandWithMovedRanges() {
@@ -1,14 +1,10 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.projectView
import com.intellij.ide.projectView.ProjectView
import com.intellij.ide.projectView.ProjectViewSettings
import com.intellij.ide.projectView.impl.AbstractProjectViewPane
import com.intellij.ide.projectView.impl.PackageViewPane
import com.intellij.ide.projectView.impl.ProjectViewFileNestingService
import com.intellij.ide.projectView.impl.*
import com.intellij.ide.projectView.impl.ProjectViewFileNestingService.NestingRule
import com.intellij.ide.projectView.impl.ProjectViewImpl
import com.intellij.ide.projectView.impl.ProjectViewPane
import com.intellij.ide.scopeView.ScopeViewPane
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.vfs.VirtualFile
@@ -29,8 +25,15 @@ abstract class AbstractProjectViewTest : TestSourceBasedTestCase() {
private var originalNestingRules: MutableList<NestingRule>? = null
override fun tearDown() {
originalNestingRules?.let { ProjectViewFileNestingService.getInstance().rules = it }
super.tearDown()
try {
originalNestingRules?.let { ProjectViewFileNestingService.getInstance().rules = it }
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
override fun getTestPath(): String? = null
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.projectView
import com.intellij.ide.projectView.ProjectViewNode
@@ -19,8 +19,15 @@ class CustomScopePaneTest : AbstractProjectViewTest() {
override fun isIconRequired() = true
override fun tearDown() {
NamedScopeManager.getInstance(project).removeAllSets()
super.tearDown()
try {
NamedScopeManager.getInstance(project).removeAllSets()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
private fun allowed(any: Any?): Boolean {
@@ -32,10 +32,16 @@ class IndexDiagnosticTest : JavaCodeInsightFixtureTestCase() {
}
override fun tearDown() {
@Suppress("LocalVariableName") val _previousLogDir = previousLogDir
super.tearDown()
IndexDiagnosticDumper.shouldDumpInUnitTestMode = false
SystemProperties.setProperty(PathManager.PROPERTY_LOG_PATH, _previousLogDir)
try {
IndexDiagnosticDumper.shouldDumpInUnitTestMode = false
SystemProperties.setProperty(PathManager.PROPERTY_LOG_PATH, previousLogDir)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
@TestFor(issues = ["IDEA-252012"])
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.suggested
import com.intellij.lang.Language
@@ -27,8 +27,15 @@ abstract class BaseSuggestedRefactoringChangeCollectorTest<TDeclaration : PsiEle
}
override fun tearDown() {
collector.reset()
super.tearDown()
try {
collector.reset()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
protected fun doTest(
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.suggested
import com.intellij.openapi.application.runWriteAction
@@ -36,8 +36,15 @@ abstract class BaseSuggestedRefactoringChangeListenerTest : LightJavaCodeInsight
}
override fun tearDown() {
Disposer.dispose(disposable)
super.tearDown()
try {
Disposer.dispose(disposable)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
protected fun setup(fileText: String) {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders
import com.intellij.util.PathUtil
@@ -11,8 +11,15 @@ class ParallelBuildTest: JpsBuildTestCase() {
}
override fun tearDown() {
System.setProperty(GlobalOptions.COMPILE_PARALLEL_OPTION, false.toString())
super.tearDown()
try {
System.setProperty(GlobalOptions.COMPILE_PARALLEL_OPTION, false.toString())
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun testBuildDependentModules() {
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.artifacts;
import com.intellij.openapi.util.io.FileUtil;
@@ -55,13 +55,20 @@ public abstract class ArtifactBuilderTestCase extends JpsBuildTestCase {
@Override
protected void tearDown() throws Exception {
for (JpsArtifact artifact : JpsArtifactService.getInstance().getArtifacts(myProject)) {
String outputPath = artifact.getOutputPath();
if (outputPath != null) {
FileUtil.delete(new File(FileUtil.toSystemDependentName(outputPath)));
try {
for (JpsArtifact artifact : JpsArtifactService.getInstance().getArtifacts(myProject)) {
String outputPath = artifact.getOutputPath();
if (outputPath != null) {
FileUtil.delete(new File(FileUtil.toSystemDependentName(outputPath)));
}
}
}
super.tearDown();
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public JpsArtifact addArtifact(LayoutElementTestUtil.LayoutElementCreator root) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.model;
import com.intellij.openapi.util.io.FileUtil;
@@ -50,8 +36,15 @@ public class CompilerEncodingConfigurationTest extends JpsEncodingConfigurationS
@Override
protected void tearDown() throws Exception {
FileUtil.delete(myDataStorageRoot);
super.tearDown();
try {
FileUtil.delete(myDataStorageRoot);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
@Override
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.references
import com.intellij.openapi.util.io.FileUtil
@@ -23,8 +23,15 @@ abstract class ReferenceIndexTestBase : JpsBuildTestCase() {
}
public override fun tearDown() {
super.tearDown()
System.clearProperty(JavaBackwardReferenceIndexWriter.PROP_KEY)
try {
System.clearProperty(JavaBackwardReferenceIndexWriter.PROP_KEY)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
protected fun assertIndexOnRebuild(vararg files: String) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.diff
import com.intellij.diff.comparison.CancellationChecker
@@ -55,8 +41,12 @@ abstract class DiffTestCase : TestCase() {
}
override fun tearDown() {
DiffIterableUtil.setVerifyEnabled(false)
super.tearDown()
try {
DiffIterableUtil.setVerifyEnabled(false)
}
finally {
super.tearDown()
}
}
fun getTestName() = UsefulTestCase.getTestName(name, true)
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.diff
import com.intellij.diff.fragments.LineFragment
@@ -55,7 +41,6 @@ abstract class HeavyDiffTestCase : DiffTestCase() {
}
}
protected fun compareExplicitBlocks(text1: CharSequence, text2: CharSequence, ranges: List<Range>,
highlightPolicy: HighlightPolicy, ignorePolicy: IgnorePolicy): List<LineFragment> {
val settings = TextDiffSettingsHolder.TextDiffSettings()
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.externalSystem.autoimport
import com.intellij.core.CoreBundle
@@ -16,9 +16,6 @@ import com.intellij.openapi.externalSystem.autoimport.ExternalSystemProjectTrack
import com.intellij.openapi.externalSystem.autoimport.MockProjectAware.RefreshCollisionPassType
import com.intellij.openapi.externalSystem.importing.ProjectResolverPolicy
import com.intellij.openapi.externalSystem.service.project.autoimport.ProjectAware
import com.intellij.platform.externalSystem.testFramework.ExternalSystemTestCase
import com.intellij.platform.externalSystem.testFramework.ExternalSystemTestUtil.TEST_EXTERNAL_SYSTEM_ID
import com.intellij.platform.externalSystem.testFramework.TestExternalSystemManager
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.progress.util.BackgroundTaskUtil
import com.intellij.openapi.project.Project
@@ -30,6 +27,9 @@ import com.intellij.openapi.util.use
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VfsUtil
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.platform.externalSystem.testFramework.ExternalSystemTestCase
import com.intellij.platform.externalSystem.testFramework.ExternalSystemTestUtil.TEST_EXTERNAL_SYSTEM_ID
import com.intellij.platform.externalSystem.testFramework.TestExternalSystemManager
import com.intellij.testFramework.ExtensionTestUtil
import com.intellij.testFramework.PlatformTestUtil
import com.intellij.testFramework.replaceService
@@ -336,8 +336,15 @@ abstract class AutoImportTestCase : ExternalSystemTestCase() {
}
override fun tearDown() {
Disposer.dispose(testDisposable)
super.tearDown()
try {
Disposer.dispose(testDisposable)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
protected fun simpleModificationTest(test: SimpleModificationTestBench.() -> Unit) {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.externalSystem.autolink
import com.intellij.openapi.Disposable
@@ -8,10 +8,10 @@ import com.intellij.openapi.externalSystem.importing.AbstractOpenProjectProvider
import com.intellij.openapi.externalSystem.importing.ExternalSystemSetupProjectTestCase
import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys
import com.intellij.openapi.externalSystem.model.ProjectSystemId
import com.intellij.platform.externalSystem.testFramework.ExternalSystemTestCase
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.platform.externalSystem.testFramework.ExternalSystemTestCase
import com.intellij.projectImport.ProjectOpenProcessor
import com.intellij.testFramework.PlatformTestUtil
import com.intellij.util.io.systemIndependentPath
@@ -29,8 +29,15 @@ abstract class AutoLinkTestCase : ExternalSystemTestCase() {
}
override fun tearDown() {
Disposer.dispose(testDisposable)
super.tearDown()
try {
Disposer.dispose(testDisposable)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
override fun getTestsTempDir() = "tmp${System.currentTimeMillis()}"
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.externalSystem.service.project.manage
import com.intellij.openapi.externalSystem.model.DataNode
@@ -25,8 +25,15 @@ class ExternalProjectsDataStorageTest: UsefulTestCase() {
}
override fun tearDown() {
myFixture.tearDown()
super.tearDown()
try {
myFixture.tearDown()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
@Test
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.externalSystem.service.ui
import com.intellij.openapi.application.ApplicationManager
@@ -30,12 +30,19 @@ abstract class ExternalSystemJdkComboBoxUtilTestCase : SdkComboBoxTestCase() {
}
override fun tearDown() {
invokeAndWaitIfNeeded {
runWriteAction {
JavaAwareProjectJdkTableImpl.removeInternalJdkInTests()
try {
invokeAndWaitIfNeeded {
runWriteAction {
JavaAwareProjectJdkTableImpl.removeInternalJdkInTests()
}
}
}
super.tearDown()
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
open fun SdkComboBox.setSelectedJdkReference(jdkReference: String?) {
@@ -46,10 +46,17 @@ class TransactionTest : LightPlatformTestCase() {
}
override fun tearDown() {
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
log.clear()
LaterInvocator.leaveAllModals()
super.tearDown()
try {
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
log.clear()
LaterInvocator.leaveAllModals()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
@Test
@@ -1,18 +1,25 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.internal.statistics.metadata.storage
import com.intellij.internal.statistic.eventLog.validator.IntellijSensitiveDataValidator
import com.intellij.internal.statistic.eventLog.validator.rules.beans.EventGroupRules
import com.intellij.internal.statistic.eventLog.validator.storage.ValidationRulesInMemoryStorage
import com.intellij.internal.statistic.eventLog.validator.storage.GroupValidationTestRule
import com.intellij.internal.statistic.eventLog.validator.storage.ValidationRulesInMemoryStorage
import com.intellij.internal.statistic.eventLog.validator.storage.ValidationTestRulesPersistedStorage
import org.assertj.core.api.Assertions.assertThat
internal class CompositeValidationRulesStorageTest : ValidationRulesBaseStorageTest() {
override fun tearDown() {
super.tearDown()
ValidationRulesInMemoryStorage.eventsValidators.clear()
try {
ValidationRulesInMemoryStorage.eventsValidators.clear()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun testGetGroupRulesFromTest() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.internal.statistics.metadata.storage
import com.intellij.internal.statistic.eventLog.validator.IntellijSensitiveDataValidator
@@ -25,17 +25,23 @@ internal abstract class ValidationRulesBaseStorageTest : BasePlatformTestCase()
}
override fun tearDown() {
super.tearDown()
ValidationTestRulesPersistedStorage.cleanupAll()
for (recorder in recordersToCleanUp) {
val file = EventLogTestMetadataPersistence(recorder).eventsTestSchemeFile
try {
FileUtil.delete(file.parent)
}
catch (e: IOException) {
LOG.error(e)
try {
ValidationTestRulesPersistedStorage.cleanupAll()
for (recorder in recordersToCleanUp) {
val file = EventLogTestMetadataPersistence(recorder).eventsTestSchemeFile
try {
FileUtil.delete(file.parent)
}
catch (e: IOException) {
LOG.error(e)
}
}
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.observable
import com.intellij.openapi.Disposable
@@ -17,8 +17,12 @@ abstract class CompoundParallelOperationTraceTestCase : TestCase() {
}
override fun tearDown() {
Disposer.dispose(testDisposable)
super.tearDown()
try {
Disposer.dispose(testDisposable)
}
finally {
super.tearDown()
}
}
protected fun <R> generate(times: Int, action: (Int) -> R): Iterable<R> {
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.testframework.sm.runner;
import com.intellij.execution.configurations.ModuleRunConfiguration;
@@ -29,9 +29,16 @@ public abstract class BaseSMTRunnerTestCase extends LightPlatformTestCase {
@Override
protected void tearDown() throws Exception {
if (mySuite != null) Disposer.dispose(mySuite);
if (mySimpleTest != null) Disposer.dispose(mySimpleTest);
super.tearDown();
try {
if (mySuite != null) Disposer.dispose(mySuite);
if (mySimpleTest != null) Disposer.dispose(mySimpleTest);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
protected SMTestProxy createTestProxy() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.testframework.sm.runner;
import com.intellij.execution.executors.DefaultRunExecutor;
@@ -94,13 +94,18 @@ public class GeneralToSMTRunnerEventsConvertorTest extends BaseSMTRunnerTestCase
@Override
protected void tearDown() throws Exception {
Disposer.dispose(myEventsProcessor);
Disposer.dispose(myConsole);
super.tearDown();
if (myTempFile != null) {
assertFalse(myTempFile.exists());
try {
Disposer.dispose(myEventsProcessor);
Disposer.dispose(myConsole);
if (myTempFile != null) {
assertFalse(myTempFile.exists());
}
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.testframework.sm.runner;
import com.intellij.openapi.diagnostic.DefaultLogger;
@@ -32,9 +18,15 @@ public class TestSuiteStackTest extends BaseSMTRunnerTestCase {
@Override
protected void tearDown() throws Exception {
disableDebugMode();
super.tearDown();
try {
disableDebugMode();
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public void testPushSuite() {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.testframework.sm.runner.ui;
import com.intellij.execution.testframework.TestConsoleProperties;
@@ -22,8 +8,6 @@ import com.intellij.execution.testframework.sm.runner.SMTestProxy;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.openapi.util.Disposer;
import javax.swing.*;
public class SMTRunnerFiltersTest extends BaseSMTRunnerTestCase {
private MockTestResultsViewer myResultsViewer;
private TestConsoleProperties myProperties;
@@ -72,13 +56,20 @@ public class SMTRunnerFiltersTest extends BaseSMTRunnerTestCase {
@Override
protected void tearDown() throws Exception {
TestConsoleProperties.HIDE_PASSED_TESTS.set(myProperties, true);
TestConsoleProperties.HIDE_IGNORED_TEST.set(myProperties, false);
TestConsoleProperties.HIDE_SUCCESSFUL_CONFIG.set(myProperties, false);
try {
TestConsoleProperties.HIDE_PASSED_TESTS.set(myProperties, true);
TestConsoleProperties.HIDE_IGNORED_TEST.set(myProperties, false);
TestConsoleProperties.HIDE_SUCCESSFUL_CONFIG.set(myProperties, false);
Disposer.dispose(myResultsViewer);
Disposer.dispose(myResultsForm);
super.tearDown();
Disposer.dispose(myResultsViewer);
Disposer.dispose(myResultsForm);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public void testShowPassedShowIgnored() {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.testframework.sm.runner.ui;
import com.intellij.execution.testframework.AbstractTestProxy;
@@ -69,9 +55,16 @@ public class SMTRunnerUIActionsHandlerTest extends BaseSMTRunnerTestCase {
@Override
protected void tearDown() throws Exception {
Disposer.dispose(myResultsViewer);
Disposer.dispose(myResultsForm);
super.tearDown();
try {
Disposer.dispose(myResultsViewer);
Disposer.dispose(myResultsForm);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public void testSelectFirstDeffect_Failed() {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.execution.testframework.sm.runner.ui;
import com.intellij.execution.runners.ExecutionEnvironment;
@@ -70,10 +56,16 @@ public class SMTestRunnerResultsFormTest extends BaseSMTRunnerTestCase {
@Override
protected void tearDown() throws Exception {
Disposer.dispose(myEventsProcessor);
Disposer.dispose(myConsole);
super.tearDown();
try {
Disposer.dispose(myEventsProcessor);
Disposer.dispose(myConsole);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public void testGetTestsRootNode() {
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij;
@@ -109,8 +109,15 @@ public abstract class FileSetTestCase extends TestSuite {
@Override
protected void tearDown() throws Exception {
FileSetTestCase.this.tearDown();
super.tearDown();
try {
FileSetTestCase.this.tearDown();
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
@Override
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.testFramework;
import com.intellij.openapi.Disposable;
@@ -32,10 +32,14 @@ public abstract class FlyIdeaTestCase extends TestCase {
@Override
protected void tearDown() throws Exception {
super.tearDown();
if (myTempDir != null) {
FileUtil.asyncDelete(myTempDir);
try {
if (myTempDir != null) {
FileUtil.asyncDelete(myTempDir);
}
Disposer.dispose(myRootDisposable);
}
finally {
super.tearDown();
}
Disposer.dispose(myRootDisposable);
}
}
@@ -22,8 +22,15 @@ public class EditorConfigEncodingInspectionTest extends InspectionFixtureTestCas
@Override
protected void tearDown() throws Exception {
EditorConfigRegistry.setSkipProjectRootInTest(false);
super.tearDown();
try {
EditorConfigRegistry.setSkipProjectRootInTest(false);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public void testEncodingMismatch() {
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea.commands
import com.intellij.credentialStore.Credentials
@@ -22,8 +22,7 @@ class GitHttpGuiAuthenticatorTest : GitPlatformTest() {
private var dialogShown = false
@Throws(Exception::class)
public override fun setUp() {
override fun setUp() {
super.setUp()
// otherwise login dialog doesn't work (missing LaF for JBOptionButton)
UIManager.setLookAndFeel("com.intellij.ide.ui.laf.darcula.DarculaLaf")
@@ -32,14 +31,18 @@ class GitHttpGuiAuthenticatorTest : GitPlatformTest() {
passwordSafe = service()
}
@Throws(Exception::class)
public override fun tearDown() {
dialogShown = false
rememberedInputs.clear()
passwordSafe.set(CREDENTIAL_ATTRIBUTES, null)
super.tearDown()
override fun tearDown() {
try {
dialogShown = false
rememberedInputs.clear()
passwordSafe.set(CREDENTIAL_ATTRIBUTES, null)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun `test data saved when correct`() {
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea.index
import com.intellij.openapi.util.io.FileUtil
@@ -94,9 +94,16 @@ class GitIndexStatusTest : GitPlatformTest() {
}
override fun tearDown() {
repositoryFiles.clear()
_repository = null
super.tearDown()
try {
repositoryFiles.clear()
_repository = null
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
private fun modify(file: FilePath) {
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea.index
import com.google.common.util.concurrent.MoreExecutors
@@ -43,11 +43,18 @@ class GitStageTrackerTest : GitSingleRepoTest() {
}
override fun tearDown() {
val t = _tracker
_tracker = null
t?.let { Disposer.dispose(it) }
repo.untrackedFilesHolder.createWaiter().waitFor()
super.tearDown()
try {
val t = _tracker
_tracker = null
t?.let { Disposer.dispose(it) }
repo.untrackedFilesHolder.createWaiter().waitFor()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun `test unstaged`() {
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea.log
import com.intellij.openapi.Disposable
@@ -39,8 +39,15 @@ class GitLogIndexTest : GitSingleRepoTest() {
}
override fun tearDown() {
Disposer.dispose(disposable)
super.tearDown()
try {
Disposer.dispose(disposable)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun `test indexed`() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.importing
import com.intellij.openapi.Disposable
@@ -6,8 +6,8 @@ import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.externalSystem.action.AttachExternalProjectAction
import com.intellij.openapi.externalSystem.autoimport.AutoImportProjectTracker
import com.intellij.openapi.externalSystem.autoimport.AutoImportProjectNotificationAware
import com.intellij.openapi.externalSystem.autoimport.AutoImportProjectTracker
import com.intellij.openapi.externalSystem.importing.ExternalSystemSetupProjectTest
import com.intellij.openapi.externalSystem.importing.ExternalSystemSetupProjectTestCase
import com.intellij.openapi.externalSystem.model.ProjectSystemId
@@ -44,9 +44,15 @@ class GradleSetupProjectTest : ExternalSystemSetupProjectTest, GradleImportingTe
}
override fun tearDown() {
Disposer.dispose(testDisposable)
super.tearDown()
try {
Disposer.dispose(testDisposable)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
override fun getSystemId(): ProjectSystemId = SYSTEM_ID
@@ -55,8 +55,15 @@ abstract class GrazieTestBase : BasePlatformTestCase() {
}
override fun tearDown() {
GrazieConfig.update { GrazieConfig.State() }
super.tearDown()
try {
GrazieConfig.update { GrazieConfig.State() }
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
protected open fun runHighlightTestForFile(file: String) {
@@ -26,8 +26,15 @@ class GroovyParameterTypeHintsInlayProviderTest : InlayHintsProviderTestCase() {
}
override fun tearDown() {
Registry.get(MethodParameterAugmenter.GROOVY_COLLECT_METHOD_CALLS_FOR_INFERENCE).resetToDefault()
super.tearDown()
try {
Registry.get(MethodParameterAugmenter.GROOVY_COLLECT_METHOD_CALLS_FOR_INFERENCE).resetToDefault()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun testSingleType() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package training.featuresSuggester
import com.intellij.openapi.Disposable
@@ -27,8 +27,15 @@ abstract class FeatureSuggesterTest : BasePlatformTestCase() {
}
override fun tearDown() {
Disposer.dispose(disposable)
super.tearDown()
try {
Disposer.dispose(disposable)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun assertSuggestedCorrectly() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.folding.impl;
import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
@@ -31,8 +31,15 @@ public class PropertiesContextFoldingTest extends BasePlatformTestCase {
@Override
protected void tearDown() throws Exception {
PropertiesFoldingSettings.getInstance().setFoldPlaceholdersToContext(old);
super.tearDown();
try {
PropertiesFoldingSettings.getInstance().setFoldPlaceholdersToContext(old);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
public void testPlaceholdersInPropertiesAreFolded() throws IOException {
@@ -21,9 +21,12 @@ class LazyFileOutputProducerTest : TestCase() {
}
override fun tearDown() {
super.tearDown()
tempDir.deleteRecursively()
AbstractLazyFileOutputProducer.invalidateCaches()
try {
tempDir.deleteRecursively()
AbstractLazyFileOutputProducer.invalidateCaches()
} finally {
super.tearDown()
}
}
fun `test simple upToDate`() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.compilerPlugin.kotlinxSerialization
@@ -21,9 +21,13 @@ abstract class AbstractSerializationQuickFixTest : AbstractQuickFixTest() {
}
override fun tearDown() {
ConfigLibraryUtil.removeLibrary(module, "Serialization JSON")
ConfigLibraryUtil.removeLibrary(module, "Serialization core")
super.tearDown()
try {
ConfigLibraryUtil.removeLibrary(module, "Serialization JSON")
ConfigLibraryUtil.removeLibrary(module, "Serialization core")
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.pacelize.ide.test
@@ -11,7 +11,12 @@ abstract class AbstractParcelizeCheckerTest : AbstractKotlinHighlightVisitorTest
}
override fun tearDown() {
removeParcelizeLibraries(module)
super.tearDown()
try {
removeParcelizeLibraries(module)
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.pacelize.ide.test
@@ -11,7 +11,12 @@ abstract class AbstractParcelizeQuickFixTest : AbstractQuickFixTest() {
}
override fun tearDown() {
removeParcelizeLibraries(module)
super.tearDown()
try {
removeParcelizeLibraries(module)
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.gradle
import com.intellij.openapi.actionSystem.DataContext
@@ -12,14 +12,18 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.atomic.AtomicInteger
class ResolveModulesPerSourceSetInMppBuildIssueTest : LightPlatformTestCase() {
override fun tearDown() {
GradleSettings.getInstance(project).apply {
linkedProjectsSettings.forEach { projectSetting ->
unlinkExternalProject(projectSetting.externalProjectPath)
try {
GradleSettings.getInstance(project).apply {
linkedProjectsSettings.forEach { projectSetting ->
unlinkExternalProject(projectSetting.externalProjectPath)
}
}
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
super.tearDown()
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.codeInsight.gradle
import com.intellij.execution.executors.DefaultRunExecutor
@@ -73,8 +73,13 @@ abstract class KotlinGradleImportingTestCase : GradleImportingTestCase() {
}
override fun tearDown() {
tearDownImportStatusCollector()
super.tearDown()
try {
tearDownImportStatusCollector()
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
protected open fun setUpImportStatusCollector() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.notifications
import com.intellij.notification.Notification
@@ -40,13 +40,18 @@ class LegacyIsResolveModulePerSourceSetNotificationTest : LightPlatformTestCase(
}
override fun tearDown() {
GradleSettings.getInstance(project).apply {
linkedProjectsSettings.forEach { projectSetting ->
unlinkExternalProject(projectSetting.externalProjectPath)
try {
GradleSettings.getInstance(project).apply {
linkedProjectsSettings.forEach { projectSetting ->
unlinkExternalProject(projectSetting.externalProjectPath)
}
}
notifications.forEach { it.expire() }
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
notifications.forEach { it.expire() }
super.tearDown()
}
fun `test shows notification when isResolveModulePerSourceSet is false`() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.refactoring.changeSignature
@@ -42,8 +42,6 @@ import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.idea.test.InTextDirectivesUtils
import org.jetbrains.kotlin.idea.test.KotlinTestUtils
import org.jetbrains.kotlin.types.typeUtil.makeNullable
import org.jetbrains.kotlin.utils.addToStdlib.assertedCast
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@@ -71,9 +69,14 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
}
override fun tearDown() {
files = emptyList()
psiFiles = PsiFile.EMPTY_ARRAY
super.tearDown()
try {
files = emptyList()
psiFiles = PsiFile.EMPTY_ARRAY
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
private lateinit var files: List<String>
@@ -34,11 +34,16 @@ class KotlinJUnitLightTest : LightJavaCodeInsightFixtureTestCase() {
@Throws(Exception::class)
override fun tearDown() {
val runManager = getInstance(project)
for (setting in tempSettings) {
runManager.removeConfiguration(setting)
try {
val runManager = getInstance(project)
for (setting in tempSettings) {
runManager.removeConfiguration(setting)
}
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
super.tearDown()
}
override fun setUp() {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.debugger.test
@@ -91,8 +91,13 @@ abstract class AbstractKotlinEvaluateExpressionTest : KotlinDescriptorTestCaseWi
}
override fun tearDown() {
exceptions.clear()
super.tearDown()
try {
exceptions.clear()
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
private fun performSingleBreakpointTest(data: EvaluationTestData) {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.debugger.test
@@ -144,8 +144,13 @@ abstract class KotlinDescriptorTestCaseWithStepping : KotlinDescriptorTestCase()
}
override fun tearDown() {
super.tearDown()
classPath.clear()
try {
classPath.clear()
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
private fun SuspendContextImpl.doStepOver(ignoreBreakpoints: Boolean = false) {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.codegen;
@@ -9,26 +9,19 @@ import kotlin.io.FilesKt;
import kotlin.text.Charsets;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.ClassFileFactory;
import org.jetbrains.kotlin.codegen.GeneratedClassLoader;
import org.jetbrains.kotlin.idea.TestHelperGeneratorKt;
import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil;
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
import org.jetbrains.kotlin.idea.test.InTextDirectivesUtils;
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
import org.jetbrains.kotlin.codegen.ClassFileFactory;
import org.jetbrains.kotlin.codegen.GeneratedClassLoader;
import org.jetbrains.kotlin.config.CompilerConfiguration;
import org.jetbrains.kotlin.idea.test.Directives;
import org.jetbrains.kotlin.idea.TestHelperGeneratorKt;
import org.jetbrains.kotlin.idea.base.plugin.artifacts.KotlinArtifacts;
import org.jetbrains.kotlin.idea.test.ConfigurationKind;
import org.jetbrains.kotlin.idea.test.KotlinTestUtils;
import org.jetbrains.kotlin.idea.test.*;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestJdkKind;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.test.*;
import org.jetbrains.kotlin.idea.test.TestFiles;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.jetbrains.kotlin.idea.test.KotlinBaseTest;
import org.jetbrains.kotlin.idea.test.KotlinBaseTest.TestFile;
import java.io.File;
import java.io.IOException;
@@ -66,16 +59,20 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
@Override
protected void tearDown() throws Exception {
myFiles = null;
myEnvironment = null;
classFileFactory = null;
try {
myFiles = null;
myEnvironment = null;
classFileFactory = null;
if (initializedClassLoader != null) {
initializedClassLoader.dispose();
initializedClassLoader = null;
if (initializedClassLoader != null) {
initializedClassLoader.dispose();
initializedClassLoader = null;
}
} catch (Throwable e) {
addSuppressedException(e);
} finally {
super.tearDown();
}
super.tearDown();
}
protected void loadMultiFiles(@NotNull List<TestFile> files) {
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.test.testFramework;
@@ -24,9 +24,14 @@ public abstract class KtPlatformLiteFixture extends KtUsefulTestCase {
@Override
protected void tearDown() throws Exception {
super.tearDown();
clearFields(this);
myProject = null;
try {
clearFields(this);
myProject = null;
} catch (Throwable e) {
addSuppressedException(e);
} finally {
super.tearDown();
}
}
@SuppressWarnings("unchecked")
@@ -7,8 +7,15 @@ import org.intellij.plugins.markdown.editor.tables.TableTestUtils.runWithChanged
class MarkdownTableTabTest: LightPlatformCodeInsightTestCase() {
override fun tearDown() {
TestScaleHelper.restoreRegistryProperties()
super.tearDown()
try {
TestScaleHelper.restoreRegistryProperties()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun `test single tab forward`() {
@@ -38,16 +38,21 @@ open class MarkdownFormatterTest : LightPlatformCodeInsightTestCase() {
}
override fun tearDown() {
val settings = CodeStyle.getSettings(project)
val common = settings.getCommonSettings(MarkdownLanguage.INSTANCE)
val custom = settings.getCustomSettings(MarkdownCustomCodeStyleSettings::class.java)
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = myOldWrap
common.RIGHT_MARGIN = myOldMargin
custom.WRAP_TEXT_IF_LONG = myOldWrapTextBlocksIfLong
custom.KEEP_LINE_BREAKS_INSIDE_TEXT_BLOCKS = myOldKeepLineBreaks
super.tearDown()
try {
val settings = CodeStyle.getSettings(project)
val common = settings.getCommonSettings(MarkdownLanguage.INSTANCE)
val custom = settings.getCustomSettings(MarkdownCustomCodeStyleSettings::class.java)
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = myOldWrap
common.RIGHT_MARGIN = myOldMargin
custom.WRAP_TEXT_IF_LONG = myOldWrapTextBlocksIfLong
custom.KEEP_LINE_BREAKS_INSIDE_TEXT_BLOCKS = myOldKeepLineBreaks
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun testSmoke() {
@@ -57,8 +57,15 @@ internal abstract class SearchEverywhereBaseFileFeaturesProviderTest<T : SearchE
}
override fun tearDown() {
EditorHistoryManager.getInstance(project).removeAllFiles()
mockedFileStatsProvider.clearStats()
super.tearDown()
try {
EditorHistoryManager.getInstance(project).removeAllFiles()
mockedFileStatsProvider.clearStats()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2020 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.stats.completion.storage
import com.intellij.stats.completion.logger.LineStorage
@@ -106,8 +92,15 @@ class FileLoggerTest : HeavyPlatformTestCase() {
}
override fun tearDown() {
try {
tempDirectory.deleteRecursively()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
fun `test chunk not empty`() {
@@ -19,8 +19,13 @@ abstract class TomlAnnotationTestBase : TomlTestBase() {
}
override fun tearDown() {
annotationFixture.tearDown()
super.tearDown()
try {
annotationFixture.tearDown()
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
protected abstract fun createAnnotationFixture(): TomlAnnotationTestFixture
@@ -19,8 +19,13 @@ abstract class TomlCompletionTestBase : TomlTestBase() {
}
override fun tearDown() {
completionFixture.tearDown()
super.tearDown()
try {
completionFixture.tearDown()
} catch (e: Throwable) {
addSuppressedException(e)
} finally {
super.tearDown()
}
}
fun checkContainsCompletion(
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python;
import com.intellij.application.options.RegistryManager;
@@ -26,8 +26,15 @@ public class PyPackageIconTest extends PyTestCase {
@Override
public void tearDown() throws Exception {
RegistryManager.getInstance().get("python.explicit.namespace.packages").resetToDefault();
super.tearDown();
try {
RegistryManager.getInstance().get("python.explicit.namespace.packages").resetToDefault();
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
// PY-38642
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.codeInsight.testIntegration
import com.intellij.openapi.application.ApplicationManager
@@ -8,7 +8,6 @@ import com.intellij.testFramework.VfsTestUtil
import com.jetbrains.python.fixtures.PyTestCase
import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.testing.PyTestFactory
import com.jetbrains.python.testing.PyUnitTestFactory
import com.jetbrains.python.testing.PythonTestConfigurationType
import com.jetbrains.python.testing.TestRunnerService
@@ -72,12 +71,19 @@ class PyTestCreationModelTest : PyTestCase() {
}
override fun tearDown() {
ApplicationManager.getApplication().invokeAndWait {
WriteAction.runAndWait<Throwable> {
dir.findChild(testsFolderName)?.let { VfsTestUtil.deleteFile(it) }
try {
ApplicationManager.getApplication().invokeAndWait {
WriteAction.runAndWait<Throwable> {
dir.findChild(testsFolderName)?.let { VfsTestUtil.deleteFile(it) }
}
}
}
super.tearDown()
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
private fun getModelForFunc() = getModel(null)
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.console
import com.intellij.openapi.command.WriteCommandAction
@@ -170,8 +170,14 @@ class PyConsoleEnterHandlerTest : PyTestCase() {
}
override fun tearDown() {
Disposer.dispose(testRootDisposable)
super.tearDown()
try {
Disposer.dispose(testRootDisposable)
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.inspections
import com.intellij.application.options.RegistryManager
@@ -15,8 +15,15 @@ class PyRelativeImportInspectionTest: PyInspectionTestCase() {
}
override fun tearDown() {
RegistryManager.getInstance()["python.explicit.namespace.packages"].resetToDefault()
super.tearDown()
try {
RegistryManager.getInstance()["python.explicit.namespace.packages"].resetToDefault()
}
catch (e: Throwable) {
addSuppressedException(e)
}
finally {
super.tearDown()
}
}
override fun getInspectionClass(): Class<out PyInspection> {