Description
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:
- Set a breakpoint in a Python test.
- Debug the test, either from the file or the testing pane
- When the code hits the breakpoint, enter
print("hello")
in the debug console - Nothing is printed, and since the test debugger is not connected to the same terminal that the file debugger connects to, the output does not appear there either.
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.2
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
- Value of the
python.languageServer
setting: Pylance
User Settings
defaultLS: {"defaultLSType":"Pylance"}
downloadLanguageServer: true
envFile: "<placeholder>"
venvPath: "<placeholder>"
venvFolders: "<placeholder>"
condaPath: "<placeholder>"
pipenvPath: "<placeholder>"
poetryPath: "<placeholder>"
languageServer: "Pylance"
linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: true
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"
sortImports
• args: "<placeholder>"
• path: "<placeholder>"
formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "black"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"
testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: false
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: true
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: false
terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"
experiments
• enabled: true
• optInto: []
• optOutFrom: []
tensorBoard
• logDirectory: "<placeholder>"