mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add test for ignore libraries parameter for exceptions breakpoint (PY-6396)
This commit is contained in:
@@ -78,6 +78,7 @@ class PyDBFrame:
|
||||
# print frame.f_code.co_name
|
||||
if exception_breakpoint.ignore_libraries:
|
||||
if mainDebugger.not_in_scope(frame.f_code.co_filename):
|
||||
pydev_log.debug("Ignore exception %s in library %s" % (exception, frame.f_code.co_filename))
|
||||
return False, frame
|
||||
|
||||
add_exception_to_frame(frame, (exception, value, trace))
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from calendar import setfirstweekday
|
||||
stopped_in_user_file = True
|
||||
setfirstweekday(15)
|
||||
@@ -324,7 +324,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_exceptbreak.py") {
|
||||
@Override
|
||||
public void before() throws Exception {
|
||||
createExceptionBreak(myFixture, true, false, false);
|
||||
createExceptionBreakZeroDivisionError(myFixture, true, false, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -342,10 +342,11 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
private static void createExceptionBreak(IdeaProjectTestFixture fixture,
|
||||
boolean notifyOnTerminate,
|
||||
boolean notifyAlways,
|
||||
boolean notifyOnFirst) {
|
||||
private static void createExceptionBreakZeroDivisionError(IdeaProjectTestFixture fixture,
|
||||
boolean notifyOnTerminate,
|
||||
boolean notifyAlways,
|
||||
boolean notifyOnFirst,
|
||||
boolean ignoreLibraries) {
|
||||
XDebuggerTestUtil.removeAllBreakpoints(fixture.getProject());
|
||||
XDebuggerTestUtil.setDefaultBreakpointEnabled(fixture.getProject(), PyExceptionBreakpointType.class, false);
|
||||
|
||||
@@ -353,11 +354,13 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
properties.setNotifyOnTerminate(notifyOnTerminate);
|
||||
properties.setNotifyAlways(notifyAlways);
|
||||
properties.setNotifyOnlyOnFirst(notifyOnFirst);
|
||||
properties.setIgnoreLibraries(ignoreLibraries);
|
||||
addExceptionBreakpoint(fixture, properties);
|
||||
properties = new PyExceptionBreakpointProperties("builtins.ZeroDivisionError"); //for python 3
|
||||
properties.setNotifyOnTerminate(notifyOnTerminate);
|
||||
properties.setNotifyAlways(notifyAlways);
|
||||
properties.setNotifyOnlyOnFirst(notifyOnFirst);
|
||||
properties.setIgnoreLibraries(ignoreLibraries);
|
||||
addExceptionBreakpoint(fixture, properties);
|
||||
}
|
||||
|
||||
@@ -365,7 +368,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_exceptbreak.py") {
|
||||
@Override
|
||||
public void before() throws Exception {
|
||||
createExceptionBreak(myFixture, false, true, false);
|
||||
createExceptionBreakZeroDivisionError(myFixture, false, true, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -391,7 +394,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_exceptbreak.py") {
|
||||
@Override
|
||||
public void before() throws Exception {
|
||||
createExceptionBreak(myFixture, false, false, true);
|
||||
createExceptionBreakZeroDivisionError(myFixture, false, false, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -409,6 +412,44 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
private static void createExceptionBreak(IdeaProjectTestFixture fixture,
|
||||
boolean notifyOnTerminate,
|
||||
boolean notifyAlways,
|
||||
boolean notifyOnFirst,
|
||||
boolean ignoreLibraries) {
|
||||
XDebuggerTestUtil.removeAllBreakpoints(fixture.getProject());
|
||||
XDebuggerTestUtil.setDefaultBreakpointEnabled(fixture.getProject(), PyExceptionBreakpointType.class, false);
|
||||
|
||||
PyExceptionBreakpointProperties properties = new PyExceptionBreakpointProperties("BaseException");
|
||||
properties.setNotifyOnTerminate(notifyOnTerminate);
|
||||
properties.setNotifyAlways(notifyAlways);
|
||||
properties.setNotifyOnlyOnFirst(notifyOnFirst);
|
||||
properties.setIgnoreLibraries(ignoreLibraries);
|
||||
addExceptionBreakpoint(fixture, properties);
|
||||
}
|
||||
|
||||
public void testExceptionBreakpointIgnoreLibraries() throws Exception {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_ignore_lib.py") {
|
||||
@Override
|
||||
public void before() throws Exception {
|
||||
createExceptionBreak(myFixture, false, true, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testing() throws Exception {
|
||||
waitForPause();
|
||||
eval("stopped_in_user_file").hasValue("True");
|
||||
resume();
|
||||
waitForTerminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return ImmutableSet.of("-jython");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testMultithreading() throws Exception {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_multithread.py") {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user