mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 22:11:40 +07:00
Fix Python Console tests
This commit is contained in:
@@ -78,6 +78,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
@@ -243,6 +245,8 @@ public class PythonConsoleView extends LanguageConsoleImpl implements Observable
|
||||
|
||||
|
||||
public void executeInConsole(@NotNull final String code) {
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
TransactionGuard.submitTransaction(this, () -> {
|
||||
final String codeToExecute = code.endsWith("\n") || myExecuteActionHandler.checkSingleLine(code) ? code : code + "\n";
|
||||
DocumentEx document = getConsoleEditor().getDocument();
|
||||
@@ -267,7 +271,16 @@ public class PythonConsoleView extends LanguageConsoleImpl implements Observable
|
||||
getConsoleEditor().getCaretModel().moveToOffset(oldOffset);
|
||||
}
|
||||
});
|
||||
|
||||
latch.countDown();
|
||||
});
|
||||
|
||||
try {
|
||||
latch.await(1, TimeUnit.MINUTES);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
public void executeStatement(@NotNull String statement, @NotNull final Key attributes) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.jetbrains.env.python;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.jetbrains.env.PyEnvTestCase;
|
||||
import com.jetbrains.env.Staging;
|
||||
import com.jetbrains.env.python.console.PyConsoleTask;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
@@ -20,7 +19,6 @@ import static org.junit.Assert.assertTrue;
|
||||
*/
|
||||
public class PythonConsoleTest extends PyEnvTestCase {
|
||||
@Test
|
||||
@Staging
|
||||
public void testConsolePrint() {
|
||||
runPythonTest(new PyConsoleTask() {
|
||||
@Override
|
||||
@@ -55,7 +53,6 @@ public class PythonConsoleTest extends PyEnvTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Staging
|
||||
public void testInterruptAsync() {
|
||||
runPythonTest(new PyConsoleTask() {
|
||||
@Override
|
||||
@@ -80,7 +77,6 @@ public class PythonConsoleTest extends PyEnvTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Staging
|
||||
public void testLineByLineInput() {
|
||||
runPythonTest(new PyConsoleTask() {
|
||||
@Override
|
||||
@@ -96,7 +92,6 @@ public class PythonConsoleTest extends PyEnvTestCase {
|
||||
|
||||
|
||||
@Test
|
||||
@Staging
|
||||
public void testVariablesView() {
|
||||
runPythonTest(new PyConsoleTask() {
|
||||
@Override
|
||||
@@ -112,7 +107,6 @@ public class PythonConsoleTest extends PyEnvTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Staging //Thread leak
|
||||
public void testCompoundVariable() {
|
||||
runPythonTest(new PyConsoleTask() {
|
||||
@Override
|
||||
@@ -128,7 +122,6 @@ public class PythonConsoleTest extends PyEnvTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
@Staging
|
||||
@Test
|
||||
public void testChangeVariable() {
|
||||
runPythonTest(new PyConsoleTask() {
|
||||
|
||||
Reference in New Issue
Block a user