Step into my code: tests

This commit is contained in:
Elizaveta Shashkova
2015-04-29 14:59:36 +03:00
parent 602fd4955c
commit 59c9dee56c
3 changed files with 61 additions and 0 deletions
+9
View File
@@ -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();