PY-34167 Fix Python exception breakpoint rendering

This commit is contained in:
Andrey Lisin
2019-03-25 12:10:36 +03:00
parent 8f3c74ab06
commit b439701326
3 changed files with 14 additions and 1 deletions
@@ -152,6 +152,8 @@ def _excepthook(exctype, value, tb):
except:
thread.additional_info.pydev_message = exception_breakpoint.qname.encode('utf-8')
thread.additional_info.pydev_message = 'python-%s' % thread.additional_info.pydev_message
pydevd_tracing.SetTrace(None) #no tracing from here
pydev_log.debug('Handling post-mortem stop on exception breakpoint %s' % exception_breakpoint.qname)
@@ -426,6 +426,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
@Override
public void testing() throws Exception {
waitForPause();
waitForOutput("message=\"python-exceptions.ZeroDivisionError\"", "message=\"python-builtins.ZeroDivisionError\"");
eval("__exception__[0].__name__").hasValue("'ZeroDivisionError'");
resume();
waitForTerminate();
@@ -469,6 +470,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
@Override
public void testing() throws Exception {
waitForPause();
waitForOutput("message=\"python-BaseException\"");
eval("__exception__[0].__name__").hasValue("'IndexError'");
resume();
}
@@ -522,6 +524,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
@Override
public void testing() throws Exception {
waitForPause();
waitForOutput("message=\"python-BaseException\"");
eval("stopped_in_user_file").hasValue("True");
resume();
waitForTerminate();
@@ -547,6 +550,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
@Override
public void testing() throws Exception {
waitForPause();
waitForOutput("message=\"python-BaseException\"");
eval("stopped_in_user_file").hasValue("True");
resume();
waitForTerminate();
@@ -572,6 +576,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
@Override
public void testing() throws Exception {
waitForPause();
waitForOutput("message=\"python-BaseException\"");
eval("__exception__[0].__name__").hasValue("'ZeroDivisionError'");
resume();
waitForTerminate();
@@ -598,6 +603,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
@Override
public void testing() throws Exception {
waitForPause();
waitForOutput("message=\"python-BaseException\"");
eval("__exception__[0].__name__").hasValue("'ZeroDivisionError'");
resume();
waitForTerminate();
@@ -40,6 +40,7 @@ import com.jetbrains.env.PyExecutionFixtureTestTask;
import com.jetbrains.python.console.PythonDebugLanguageConsoleView;
import com.jetbrains.python.debugger.*;
import com.jetbrains.python.debugger.pydev.PyDebugCallback;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -241,10 +242,14 @@ public abstract class PyBaseDebuggerTask extends PyExecutionFixtureTestTask {
pw.flush();
}
private void outputContains(String substring) {
protected void outputContains(String substring) {
Assert.assertTrue(output().contains(substring));
}
protected void outputContains(String substring, int times) {
Assert.assertEquals(times, StringUtils.countMatches(output(), substring));
}
public void setProcessCanTerminate(boolean processCanTerminate) {
myProcessCanTerminate = processCanTerminate;
}