From 5007a810b025332cd6e5a56797ba454c82392d85 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Thu, 1 Nov 2018 00:35:12 +0300 Subject: [PATCH] svn: Fix tests - wait change list manager in "tearDown()" --- .../org/jetbrains/idea/svn/SvnTestCase.java | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestCase.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestCase.java index 944a1d3e2b89..7c4463e4034d 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestCase.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestCase.java @@ -23,6 +23,7 @@ import com.intellij.openapi.vcs.rollback.RollbackProgressListener; import com.intellij.openapi.vcs.update.CommonUpdateProjectAction; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.testFramework.ApplicationRule; +import com.intellij.testFramework.RunAll; import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory; import com.intellij.testFramework.fixtures.TempDirTestFixture; import com.intellij.testFramework.vcs.AbstractJunitVcsTestCase; @@ -207,15 +208,28 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { @After public void tearDown() throws Exception { - runInEdtAndWait(() -> { - tearDownProject(); + runInEdtAndWait( + () -> new RunAll( + this::waitChangeListManager, + this::tearDownProject, + this::tearDownTempDirectoryFixture, + () -> resetCanonicalTempPathCache(ORIGINAL_TEMP_DIRECTORY) + ).run() + ); + } - if (myTempDirFixture != null) { - myTempDirFixture.tearDown(); - myTempDirFixture = null; - } - resetCanonicalTempPathCache(ORIGINAL_TEMP_DIRECTORY); - }); + private void waitChangeListManager() { + if (changeListManager != null) { + changeListManager.forceStopInTestMode(); + changeListManager.waitEverythingDoneInTestMode(); + } + } + + private void tearDownTempDirectoryFixture() throws Exception { + if (myTempDirFixture != null) { + myTempDirFixture.tearDown(); + myTempDirFixture = null; + } } protected ProcessOutput runSvn(String... commandLine) throws IOException {