-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 output for test discovery has misleading argument #19820
Comments
Hello! Thank you for submitting this bug, we appreciate your help. Do you notice this bug when you run both pytests and unittests or is it present on only one? |
I haven't tried unittests |
Hello and sorry for the delay, this looks to be a bug in the test adapter that is likely related to the ongoing buggy behavior on pytest discovery and running in vscode. We are currently work on a rewrite of how pytest works in vscode and hope this rewrite will fix this and similar bugs. The main issue which will be working on is here: #17242, and progress will be updated on this issue. Thank you! |
Hi! This issue should be fixed with the rewrite that is released via an experiment. I would like to expand this to make it more comprehensive. I would like the logs to include a specific command you can copy and paste to run in the terminal. This will need to be delayed for an other fix which needs to be done first but I made this issue to track it. |
Type: Bug
Behaviour
Expected vs. Actual
Expected:
The output found in "Python" when refreshing tests produces a verbatum command that can be copy and pasted into a terminal to reproduce an issue.
Actual:
The output has
.
as the--rootdir
argument, but the actual argument passed in is a directory (likely the workspace one) with an absolute pathExample:
Steps to reproduce:
run_adapter.py
file to addprint(sys.argv)
. You might have to add the sys import.
as therootdir
argument.Significance
When writing custom logic, the cwd
.
and the actual directory argument provided may technically be equivalent, but the test explorer will insert the absolute path in front of the source file's location when it parses the results as if it was a relative path if the path returned does not start with.
Example:
/workspaces/my-project/src/my-file.py
becomes
/workspaces/my-project/workspaces/my-project/src/my-file.py
Which then fails to open.
Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2022.14.0
VS Code version: Code 1.70.2 (Universal) (e4503b30fc78200f846c62cf8091b76ff5547662, 2022-08-16T05:36:37.829Z)
OS version: Darwin x64 21.6.0
Modes:
Remote OS version: Linux x64 5.10.76-linuxkit
Remote OS version: Linux x64 5.4.0-1089-azure
Remote OS version: Linux x64 5.10.76-linuxkit
Remote OS version: Linux x64 5.10.76-linuxkit
A/B Experiments
The text was updated successfully, but these errors were encountered: