Skip to content
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

Debug Tests No Output #24424

Open
alexwilson1 opened this issue Nov 12, 2024 · 4 comments
Open

Debug Tests No Output #24424

alexwilson1 opened this issue Nov 12, 2024 · 4 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@alexwilson1
Copy link

Type: Bug

Behaviour

No output in 'Test Results' when using 'Debug Tests' unless launch.json is set explicitly like this:

        {
            "name": "Python: Debug Tests",
            "type": "debugpy",
            "request": "launch",
            "console": "integratedTerminal",
            "purpose": [
                "debug-test"
            ],
        }

Steps to reproduce:

  1. Press 'Debug Tests' and see there is no output

Diagnostic data

Extension version: 2024.18.1
VS Code version: Code 1.95.1 (Universal) (65edc4939843c90c34d61f4ce11704f09d3e5cb6, 2024-10-31T05:14:54.222Z)
OS version: Darwin arm64 24.0.0
Modes:
Remote OS version: Linux arm64 6.8.0-39-generic

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.7
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

testing
• pytestEnabled: true

Installed Extensions
Extension Name Extension Id Version
autopep8 ms-python.autopep8 2024.0.0
Data Wrangler ms-toolsai.datawrangler 1.12.1
ESLint dbaeumer.vscode-eslint 3.0.10
Even Better TOML tamasfe.even-better-toml 0.19.2
Git Graph mhutchie.git-graph 1.30.0
GitLens — Git supercharged eamodio.gitlens 15.6.3
JavaScript Debugger ms-vscode.js-debug 1.95.1
Jupyter ms-toolsai.jupyter 2024.10.0
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.21
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Pylance ms-python.vscode-pylance 2024.11.1
Python ms-python.python 2024.18.0
Python Debugger ms-python.debugpy 2024.12.0
Ruff charliermarsh.ruff 2024.54.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
f8hc8238:30694864
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
jg8ic977:31013176
dvdeprecation:31068756
dwnewjupytercf:31046870
2f103344:31071589
impr_priority:31102340
nativerepl2:31139839
refactort:31108082
pythonrstrctxt:31112756
cf971741:31144450
iacca1:31171482
notype1:31157159
5fd0e150:31155592
dwcopilot:31170013

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Nov 12, 2024
@eleanorjboyd
Copy link
Member

Hi! To use the test result output you have to go through the test explorer, so using this debug button here:

Image

@alexwilson1
Copy link
Author

alexwilson1 commented Nov 15, 2024

Thanks for the reply!

Yes, when pressing Debug Test button as shown (this is what I was originally referring to) in the testing window I get the below output, and none of the logging statements are shown as the test is running or at all
Image

If I set the launch.json as is shown above, I get all the correct logging output as the test is running and it's also shown at the end, like below:

DEBUG    module.base:base.py:329 All required tasks completed successfully.
INFO     module.base:base.py:407 Completed getting all data
PASSED
------------------------------ live log teardown -------------------------------
DEBUG    asyncio:selector_events.py:64 Using selector: EpollSelector


============================== 1 passed in 4.87s ===============================

Wondering why adding the snippet to launch.json allows the output logs to be shown but the default does not.

@eleanorjboyd
Copy link
Member

When you debug tests, then go to the debug console, can you see the output there? It might be going there and not be going to the test output channel at all since it is caught and printed in the debug console. Then also for the launch.json, where are you seeing that output? In which panel?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Nov 18, 2024
@alexwilson1
Copy link
Author

Ah, it is outputting to the debug console you are correct. With the launch.json, it outputs to the terminal.

I think the confusing thing with the default behavior (without launch.json addition) is that when you press 'debug tests' it automatically takes you to the test results window (empty), even though the output is going to debug console. Perhaps if it automatically went to the debug console that would be ideal?

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants