-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
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
- Extract example zip file
- Create new workspace
- Add project_1 directory to workspace
- Add project_2 directory to workspace
- Open project_1/src/tests/test_func1.py
- Discover python tests in project_1
Run Test/Debug Test annotations should appear on screen. Running the test works, etc.
- Open project_2/src/tests/test_magic.py (or any other file in project_2)
- Return to test_func1.py
Test annotations we saw earlier will now disappear.
- Discover tests in project_2 (if not done automatically)
No test annotations appear in either test_func1.py or test_magic.py.
- Close test_magic.py
Test annotations in test_func1.py do not reappear, even if one tries rediscover tests, etc.
- 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.