mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Step into my code: tests
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
from calendar import setfirstweekday
|
||||
|
||||
def foo(x):
|
||||
return x + 1
|
||||
|
||||
foo(2)
|
||||
stopped_in_user_file = True
|
||||
setfirstweekday(3)
|
||||
x = 9
|
||||
@@ -234,6 +234,48 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
public void testStepIntoMyCode() throws Exception {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_my_code.py") {
|
||||
@Override
|
||||
public void before() throws Exception {
|
||||
toggleBreakpoint(getScriptPath(), 5);
|
||||
toggleBreakpoint(getScriptPath(), 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testing() throws Exception {
|
||||
waitForPause();
|
||||
stepIntoMyCode();
|
||||
waitForPause();
|
||||
eval("x").hasValue("2");
|
||||
resume();
|
||||
waitForPause();
|
||||
stepIntoMyCode();
|
||||
waitForPause();
|
||||
eval("stopped_in_user_file").hasValue("True");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testStepIntoMyCodeFromLib() throws Exception {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_my_code.py") {
|
||||
@Override
|
||||
public void before() throws Exception {
|
||||
toggleBreakpoint(getScriptPath(), 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testing() throws Exception {
|
||||
waitForPause();
|
||||
stepInto();
|
||||
waitForPause();
|
||||
stepIntoMyCode();
|
||||
waitForPause();
|
||||
eval("stopped_in_user_file").hasValue("True");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testSmartStepInto() throws Exception {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test3.py") {
|
||||
@Override
|
||||
|
||||
@@ -91,6 +91,16 @@ public abstract class PyBaseDebuggerTask extends PyExecutionFixtureTestTask {
|
||||
currentSession.stepInto();
|
||||
}
|
||||
|
||||
protected void stepIntoMyCode() {
|
||||
XDebugSession currentSession = XDebuggerManager.getInstance(getProject()).getCurrentSession();
|
||||
|
||||
Assert.assertTrue(currentSession.isSuspended());
|
||||
Assert.assertEquals(0, myPausedSemaphore.availablePermits());
|
||||
|
||||
PyDebugProcess debugProcess = (PyDebugProcess)currentSession.getDebugProcess();
|
||||
debugProcess.startStepIntoMyCode();
|
||||
}
|
||||
|
||||
protected void smartStepInto(String funcName) {
|
||||
XDebugSession currentSession = XDebuggerManager.getInstance(getProject()).getCurrentSession();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user