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

Code lenses don't work after opening files from different projects in workspace #12995

Closed
DanielFEvans opened this issue Jul 16, 2020 · 4 comments · Fixed by #16769
Closed

Code lenses don't work after opening files from different projects in workspace #12995

DanielFEvans opened this issue Jul 16, 2020 · 4 comments · Fixed by #16769
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@DanielFEvans
Copy link

I believe the Python extension is the correct place to report this, but it's difficult to tell which of the possible core/extension features is actually at fault.

Environment data

  • VS Code version: 1.47.0
  • Extension version (available under the Extensions sidebar): 2020.6.91350
  • OS and version: Windows 10, running remotely on Scientific Linux 7.6
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.8, from OS.
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv.
  • Relevant/affected Python packages and their versions: Unittest (Py3.6 standard library), nose (1.3.7)
  • Relevant/affected Python-related VS Code extensions and their versions: Remote - SSH 0.51.0
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

When I have a workspace with multiple project folders, I should be able to open files from multiple projects without losing test annotations (Run Test / Debug Test).

Note that I am running remotely on a Linux machine from Windows; I don't know if the same issue occurs locally.

Actual behaviour

After opening a file from one project folder, and then opening a file from a second project folder, test annotations no longer work.

Steps to reproduce:

Small example containing two project folders, with a single test in each:
vscode_python_test_issue.zip

  1. Extract example zip file
  2. Create new workspace
  3. Add project_1 directory to workspace
  4. Add project_2 directory to workspace
  5. Open project_1/src/tests/test_func1.py
  6. Discover python tests in project_1

Run Test/Debug Test annotations should appear on screen. Running the test works, etc.

  1. Open project_2/src/tests/test_magic.py (or any other file in project_2)
  2. Return to test_func1.py

Test annotations we saw earlier will now disappear.

  1. Discover tests in project_2 (if not done automatically)

No test annotations appear in either test_func1.py or test_magic.py.

  1. Close test_magic.py

Test annotations in test_func1.py do not reappear, even if one tries rediscover tests, etc.

  1. Use VSCode "Reload Window" function, or close and reopen fully.

Test annotations appear in test_func1.py again, but will disappear if anything from project_2 is opened.

This behaviour can also be observed by opening the project_2 tests first and then opening project_1. It also occurs if non-test files are opened - e.g. open func1.py in project 1, open magic.py from project 2, then open any test file.

Logs

I have not observed any unusual behaviour in the "Python Test Log". Let me know if any of the (many!) other logs are worth inspecting.

@DanielFEvans DanielFEvans added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jul 16, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jul 16, 2020
@karrtikr
Copy link

Unfortunately we have noticed that there are some other extensions which may interfere with Codelens, for eg. Liveshare. Please try disabling the other extensions one by one and see which one is causing the issue.

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Jul 16, 2020
@DanielFEvans
Copy link
Author

The issue still occurs with all extensions bar Python disabled (locally on Windows 10), or with just Python + Remote-SSH (remotely on Linux).

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Jul 17, 2020
@karrtikr
Copy link

Thanks for the bug report, I am able to reproduce this issue.

@karrtikr karrtikr removed their assignment Jul 20, 2020
@luabud luabud changed the title Test annotations don't work after opening files from different projects in workspace Code lenses don't work after opening files from different projects in workspace Jul 20, 2021
@luabud luabud added the verified Verification succeeded label Jul 29, 2021
@luabud
Copy link
Member

luabud commented Jul 29, 2021

This is fixed by #16769. Code lenses are removed in that PR, but test files from the two workspaces have the actions on the gutter that trigger the test run:

image

@karthiknadig karthiknadig added this to the August 2021 milestone Aug 5, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants