diff --git a/python/testData/debug/test_return_values.py b/python/testData/debug/test_return_values.py new file mode 100644 index 000000000000..b289abfdf52f --- /dev/null +++ b/python/testData/debug/test_return_values.py @@ -0,0 +1,13 @@ + +def bar(): + return [1, 2, 3] + + +def foo(): + bar() + return 33 + + +foo() +a = 1 +b = 2 \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java b/python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java index 5e5f9c0fe479..f8cfee919629 100644 --- a/python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java +++ b/python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java @@ -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