From 48cd8061c4061ac77a2b5ca18136a305d72f742a Mon Sep 17 00:00:00 2001 From: Egor Eliseev Date: Tue, 24 Feb 2026 08:52:12 +0000 Subject: [PATCH] [python] PY-87784, PY-87782: pytest output is not formatted correctly Fix pytest test results merging into a single line in the Debug console. Also fix PY-87784 NPE when trying to view the value of a variable after the code has finished running in the console. Merge-request: IJ-MR-192615 Merged-by: Egor Eliseev (cherry picked from commit 03dbea8699aadd447456b23fdefd55b950038bba) IJ-MR-192615 GitOrigin-RevId: 6d584e764f9369167c43d179777aa4966081d951 --- python/pydevSrc/resources/messages/PydevBundle.properties | 3 ++- .../com/jetbrains/python/debugger/PyFullValueEvaluator.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python/pydevSrc/resources/messages/PydevBundle.properties b/python/pydevSrc/resources/messages/PydevBundle.properties index ec4be95ae384..ce01cf3c28c6 100644 --- a/python/pydevSrc/resources/messages/PydevBundle.properties +++ b/python/pydevSrc/resources/messages/PydevBundle.properties @@ -3,4 +3,5 @@ pydev.show.value=Show Value pydev.view.as=...View as {0} pydev.view.as.image=...View as Image pydev.value.protected.attributes.group.name=Protected Attributes -pydev.error.message.failed.to.find.free.socket.port=Failed to find a free socket port \ No newline at end of file +pydev.error.message.failed.to.find.free.socket.port=Failed to find a free socket port +pydev.session.finished=Session has ended \ No newline at end of file diff --git a/python/pydevSrc/src/com/jetbrains/python/debugger/PyFullValueEvaluator.java b/python/pydevSrc/src/com/jetbrains/python/debugger/PyFullValueEvaluator.java index fc6fca86d8e9..1858c8bc7203 100644 --- a/python/pydevSrc/src/com/jetbrains/python/debugger/PyFullValueEvaluator.java +++ b/python/pydevSrc/src/com/jetbrains/python/debugger/PyFullValueEvaluator.java @@ -3,6 +3,7 @@ package com.jetbrains.python.debugger; import com.intellij.openapi.application.ApplicationManager; import com.intellij.xdebugger.frame.XFullValueEvaluator; +import com.jetbrains.python.PydevBundle; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; @@ -45,6 +46,10 @@ public class PyFullValueEvaluator extends XFullValueEvaluator { ApplicationManager.getApplication().executeOnPooledThread(() -> { try { final PyDebugValue value = myDebugProcess.evaluate(expression, false, doTrunc); + if (value == null) { + callback.evaluated(PydevBundle.message("pydev.session.finished")); + return; + } if (value.getValue() == null) { throw new PyDebuggerException("Failed to Load Value"); }