Add test (PY-13540)

This commit is contained in:
Elizaveta Shashkova
2016-05-18 18:31:25 +03:00
parent 77f771576c
commit 6afd1b4e53
2 changed files with 43 additions and 0 deletions
@@ -0,0 +1,13 @@
def bar():
return [1, 2, 3]
def foo():
bar()
return 33
foo()
a = 1
b = 2
@@ -18,6 +18,7 @@ import com.jetbrains.env.python.debug.PyDebuggerTask;
import com.jetbrains.env.ut.PyUnitTestProcessRunner;
import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.console.pydev.PydevCompletionVariant;
import com.jetbrains.python.debugger.PyDebugValue;
import com.jetbrains.python.debugger.PyDebuggerException;
import com.jetbrains.python.debugger.PyExceptionBreakpointProperties;
import com.jetbrains.python.debugger.PyExceptionBreakpointType;
@@ -908,6 +909,35 @@ public class PythonDebuggerTest extends PyEnvTestCase {
});
}
@Test
public void testReturnValues() throws Exception {
runPythonTest(new PyDebuggerTask("/debug", "test_return_values.py") {
@Override
public void before() throws Exception {
toggleBreakpoint(getScriptPath(), 7);
toggleBreakpoint(getScriptPath(), 11);
final PyDebuggerSettings debuggerSettings = PyDebuggerSettings.getInstance();
debuggerSettings.WATCH_RETURN_VALUES = true;
}
@Override
public void doFinally() {
final PyDebuggerSettings debuggerSettings = PyDebuggerSettings.getInstance();
debuggerSettings.WATCH_RETURN_VALUES = false;
}
@Override
public void testing() throws Exception {
waitForPause();
eval(PyDebugValue.RETURN_VALUES_PREFIX + "bar[0]").hasValue("1");
resume();
waitForPause();
eval(PyDebugValue.RETURN_VALUES_PREFIX + "foo").hasValue("33");
resume();
}
});
}
//TODO: fix me as I don't work properly sometimes (something connected with process termination on agent)
@Staging