mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup in Python Console tests
This commit is contained in:
@@ -84,36 +84,30 @@ public class PyConsoleTask extends PyExecutionFixtureTestTask {
|
||||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (myConsoleView != null) {
|
||||
disposeConsole();
|
||||
myCommunication.waitForTerminate();
|
||||
}
|
||||
PyConsoleTask.super.tearDown();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> {
|
||||
try {
|
||||
if (myConsoleView != null) {
|
||||
disposeConsole();
|
||||
myCommunication.waitForTerminate();
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void disposeConsole() throws InterruptedException {
|
||||
if (myCommunication != null) {
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
myCommunication.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
myCommunication = null;
|
||||
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> {
|
||||
try {
|
||||
myCommunication.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
myCommunication = null;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -324,12 +318,7 @@ public class PyConsoleTask extends PyExecutionFixtureTestTask {
|
||||
protected void exec(final String command) throws InterruptedException {
|
||||
waitForReady();
|
||||
myCommandSemaphore.acquire(1);
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myConsoleView.executeInConsole(command);
|
||||
}
|
||||
});
|
||||
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> myConsoleView.executeInConsole(command));
|
||||
Assert.assertTrue(String.format("Command execution wasn't finished: `%s` \n" +
|
||||
"Output: %s", command, output()), waitFor(myCommandSemaphore));
|
||||
myCommandSemaphore.release();
|
||||
@@ -388,12 +377,9 @@ public class PyConsoleTask extends PyExecutionFixtureTestTask {
|
||||
|
||||
|
||||
public void addTextToEditor(final String text) {
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getConsoleView().setInputText(text);
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
}
|
||||
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> {
|
||||
getConsoleView().setInputText(text);
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user