-
Notifications
You must be signed in to change notification settings - Fork 160
Print statements not showing in debug console during test debugging #899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This happens because If you don't want that behavior you can pass -- this changed from the last version because previously we'd always capture and print the output, but on the regular case what'd happen is that the output would appear printed twice. Now we no longer do that, but this has the downside that if a tool (such as pytest) captures it nothing will be printed. I guess we could potentially have some setting to always replay messages, but I'm not sure it's much better than disabling the pytest capture (in practice when debugging I always disable pytest capture because you're usually debugging a single test anyways and the capture in this case is just annoying). |
+1 to this issue, some workarounds that I found |
@fabioz where does that need to be set? I've tried setting it via |
I tried setting it in my |
Behaviour
Expected vs. Actual
When debugging a Python file, if I run a print command from the debug console (like

print("hello")
), I see the result of the command in two places- both in the debug console and in the terminal the debugger is connected to. If I simply enter a string in the debug console it also returns, but it is a pain to use if there are newlines in it. A screenshot of what I see when I use the file debugger is below.Within the last week or two, I have noticed that if I debug a Python test and I run a print command, the result does not appear in the console. Furthermore, when debugging tests, it does not connect to the same terminal that the Python file debugger does so I can't check the printed result there either. If I simply enter a string in the debug console it does return, but it is a pain to use if there are newlines in it. A screenshot of what I see when I use the test debugger is below.

I would expect that running a print command in the debug console while debugging a test would show the printed value in the debug console just as it does when debugging a file.
Steps to reproduce:
print("hello")
in the debug consoleDiagnostic data
python.languageServer
setting: PylanceUser Settings
The text was updated successfully, but these errors were encountered: