-
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
Run Test | Debug Test disappear on save, then re-appear when tabbing on/off the file. #2790
Comments
I'm unable to replicate this issue. |
Thanks for taking a look @DonJayamanne . I have set up a repro in this repo: https://github.com/amittleider/vscode_python_bug_repro . Here are the steps:
Next, open VScode and use the "Add folder to workspace" and select the folder Next, set your workspace settings to the following json:
Set your user settings to the following json:
Next, use the VScode console to "Discover Unit Tests", like the gif below. Next, hopefully you will see the bug as well. Here is a gif of the bug repro using the repository I made. |
Is there any more information that I can give to help? I have updated my version of the extension and the version of the VSCode today. Unfortunately the problem is worse -- Now I never see the Code Lens for Run Tests | Debug Tests, no matter what. There is another bug open on the issue here: #2908 . The difference is that my tests have no types in them (although the code that runs inside of the tests are typed). Below is a new gif. I begin by discovering unit tests, but no code lens shows up. Then I run the current unit test file, which succeeds. Then I debug the current unit test, which hits the breakpoint properly. VSCode version: 1.29.0 |
Could you edit the file (add an empty line), then close and re-open the file. |
I tried to add some new lines, close, and re-open, but it didn't work. I also tried to disabled the C#, C++, and Docker extensions for my workspace (now I just have your Python extension and a VS keymap enabled for this workspace), and it looks like I'm back to the behavior that I originally posted on Oct 4 (Run Test | Debug Test code lens appears when you arrive on the file, but if you save, it disappears). I had a debugging session today on the issue. It appears to me the problem is coming from
When I tab onto the file (the case where Run Tests | Debug Tests appears properly), the symbols variable is properly populated. When I save the file (the case where Run Tests | Debug Tests disappears), the symbols variable an empty array, so the |
This is happening to me too, whenever I edit a test file. Is there a way to simply disable the test code lens? I know #1654 asked for it but you declined it because it was asking two things at the same time. |
@amittleider |
@DonJayamanne Thank you! Disabling Jedi fixes the issue. |
Well, I notice after using the MS Python langauge server that it has its own problems. For example, sometimes I can't navigate with F12. Also, sometimes my VSCode gets stuck in a bad state and I have to reload. Also, it is not directly showing me symantec errors like a misspelled import. It puts a green squiggly underneath of it, but it's not obvious that it isn't simply a linting error like 'line length too long'. I am assuming that the MS Python Language server will completely replace Jedi in the future? I hope the improvements come fast. |
Please create separate issues for each of these.
Yes, that's correct. Again please create issues for these with examples so they can be looked at. |
The problem remains for me: the Python language server is insufficient at the moment, and I would rather keep using Jedi and disable the test code lens. |
Please could you be more specific. I would like to understand the reasons better, as the plan is to migrate to the Language Server as the default. |
@d3r3kk (on Windows) was able to replicate a similar issue. Basically code lenses do not appear for PyTest. |
Thanks for the update. I don't think it's related to just PyTest (I'm running with NoseTests). Also, I'm not sure what you mean by 'use flask repo'. Indeed, Go To Definition hangs for me sometimes with MS language server, and I'm required to restart my VSCode, but this particular issue covers a code lens problem using Jedi. |
Refers to reproduction - I was able to see your issue when I opened the Flask repo in VS Code with our extension. |
Hey I still can reproduce this issue on This is my python config:
Adding |
@jonyrock , the original issue has not yet been resolved. However, I normally work around this issue by tabbing off and on the file again because IMO the MS Language Server is not nearly as good as Jedi for the moment. |
@amittleider Please could you create an issue with the details explaining why you believe Jedi is better. |
@DonJayamanne , the majority of issues with the MS Language Server for me are with the "Go to definition" and "Find references" functions. I have commented on an issue here: microsoft/python-language-server#850 . Update: Here's a list of issues regarding the MS Language Server that prevent me from wanting to move away from Jedi:
|
FYI "python.jediEnabled":false worked for me also. The CodeLens adornments were disappearing. Switching Jedi off fixed the problem |
Attempting to get tests to stop 'jumping around' while writing code microsoft/vscode-python#2790
I switched to the Microsoft Python Language Server recently to get the "code lenses" for tests to stop constantly "jumping around" while writing code. Thankfully, it solved that problem, but now vscode can't find my library code and I get "unresolved import" warnings everywhere. This is documented, and I'm supposed to add a "python.autoComplete.extraPaths" setting (edit: or a |
Bit of an old one, but I still see the "Run Test | Debug Test" buttons/links disappearing and re-appearing when saving the file if Jedi is used. This doesn't happen with the Microsoft language server. OS: Windows_NT x64 10.0.19041 |
@vbersier From the discussions above, I don't think anyone plans on fixing the issue with Jedi either. Your best bet is to switch to the MS Language server, and if you find any issues using the MS language server, open issues for those, because you will be much better supported. |
Fixed by #16769, we don't have code lenses anymore: |
Environment data
Actual behavior
I have 2 files,
test_vscode1.py
andtest_vscode2.py
. I first discover the unit tests to get theRun Test | Debug Test
buttons. Next, I remove thei = 0
line and re-save the file. TheRun Test | Debug Test
disappears permanently if I stay on this file. Next, I tab to thetest_vscode1.py
file and back to thetest_vscode2.py
file and theRun Test | Debug Test
buttons re-appear.Expected behavior
Don't make the
Run Test | Debug Test
buttons disappear on save.Steps to reproduce:
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
)devlogs.txt
The text was updated successfully, but these errors were encountered: