Tests: always shut down async evaluation service in tests

This commit is contained in:
Elizaveta Shashkova
2018-02-19 18:17:56 +03:00
parent 268a8b8bfc
commit 58a60e4418
3 changed files with 12 additions and 1 deletions
@@ -6,6 +6,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.util.ConcurrencyUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.util.ArrayList;
import java.util.List;
@@ -72,4 +73,11 @@ public final class PyDebugValueExecutionService {
myAsyncValuesExecutorService = null;
}
}
@TestOnly
public synchronized void shutDownNow() {
if (myAsyncValuesExecutorService != null) {
myAsyncValuesExecutorService.shutdownNow();
}
}
}
@@ -305,7 +305,7 @@ public class PyConsoleTask extends PyExecutionFixtureTestTask {
if (count > 10) {
Assert.fail("Console is not ready");
}
Thread.sleep(300);
Thread.sleep(2000);
count++;
}
}
@@ -20,6 +20,7 @@ import com.intellij.xdebugger.*;
import com.jetbrains.env.python.PythonDebuggerTest;
import com.jetbrains.python.debugger.PyDebugProcess;
import com.jetbrains.python.debugger.PyDebugRunner;
import com.jetbrains.python.debugger.PyDebugValueExecutionService;
import com.jetbrains.python.run.PythonCommandLineState;
import com.jetbrains.python.run.PythonConfigurationType;
import com.jetbrains.python.run.PythonRunConfiguration;
@@ -233,6 +234,8 @@ public class PyDebuggerTask extends PyBaseDebuggerTask {
waitFor(processHandler);
}
PyDebugValueExecutionService.getInstance(getProject()).shutDownNow();
if (!processHandler.isProcessTerminated()) {
killDebugProcess();
if (!waitFor(processHandler)) {