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

Testing code lenses don't show for remote sessions to a directory symlink. #7443

Closed
yphillip opened this issue Sep 17, 2019 · 8 comments · Fixed by #16769
Closed

Testing code lenses don't show for remote sessions to a directory symlink. #7443

yphillip opened this issue Sep 17, 2019 · 8 comments · Fixed by #16769
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@yphillip
Copy link

Environment data

  • VS Code version: 1.38.1
  • Extension version: 2019.9.34911
  • OS and version: WSL (Windows 10.0.18362 Build 18362)
  • Python version: Conda 3.7.4
  • Type of virtual environment used: Conda
  • Relevant/affected Python packages and their versions: pytest-5.0.1

Expected behaviour

I am using python in a conda environment in WSL. I configured VS Code to use the correct WSL python interpreter, and I expected that the code adornments would be available.

Actual behaviour

VSCode discovers the test and it can be run , but there is no visible adornment.

WSL (no code adornments):
image

Interestingly, I installed conda/python on Windows, and when I switch over to that interpreter in VS Code, the code adornments are available.

Windows (code adornments available)
image

Steps to reproduce:

  1. Install pytest.
  2. Write a test
  3. Choose the WSL Conda python interpreter
  4. Code adornments not available.
    vs.
  5. Disconnect from WSL
  6. Choose the Windows Conda python interpreter
  7. Code adornments become available

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

> ~/miniconda3/envs/APT/bin/python ~/.vscode-server/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/run_adapter.py discover pytest -- -s .
cwd: ~/PhillipYen/Desktop/project1
> conda info --json
> ~/miniconda3/envs/APT/bin/python ~/.vscode-server/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/run_adapter.py discover pytest -- -s --cache-clear .
cwd: ~/PhillipYen/Desktop/project1
@yphillip yphillip added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 17, 2019
@yphillip
Copy link
Author

yphillip commented Sep 17, 2019 via email

@yphillip
Copy link
Author

yphillip commented Sep 17, 2019

My colleague showed me another way to start VS Code with WSL, and in this way, the code adornments become available:

  1. Open VS Code in Windows (e.g through Start menu)
  2. Click "Open a remote window" in the bottom left hand corner
  3. Click "Remote-WSL: New Window"
  4. In the new VS Code window, browse to your project folder.
  5. Make sure the interpreter is correct.
  6. Code adornments should now be available.

image

Still unsure why this method works for showing the adornments, but the code . from the WSL Windows Terminal method doesn't work.

@yphillip
Copy link
Author

I think I figured it out. The problem has something to do with running code . from a directory derived from a symbolic link.

When I cd to the absolute path and then run code . , the code adornments become available.
cd
Before, I had cd'ed to the path via a symbolic link and then run code ., which wouldn't show the code adornments.

@ericsnowcurrently ericsnowcurrently self-assigned this Sep 18, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 18, 2019
@ericsnowcurrently
Copy link
Member

Thanks for letting us know about this, @yphillip. I was able to reproduce the problem via both remote-WSL and remote-SSH (to a linux host). I was not able to reproduce this with "code ." directly on linux. We will investigate further.

Repro

To reproduce:

  1. run mkdir /tmp/test-7443
  2. run ln -s /tmp/test-7443 /tmp/test-7443-lnk
  3. create /tmp/test-7443/test_spam.py with content of def test_spam(): assert True
  4. open /tmp/test-7443-lnk in VS Code (on WSL: code /tmp/test-7443-lnk; over SSH: use UI)
  5. open test_spam.py
  6. in the command palette, run the command to configure tests (pytest)

Via remote-WSL or remote-SSH, the code lens for the test does not show up. (Note that the test does show up in the test explorer on the left.) Both remote sessions work correctly if /tmp/test-7443 is opened directly (rather than the symlink).

@ericsnowcurrently
Copy link
Member

Note that this may also be a problem with upstream VS Code, rather than the extension. We'll figure that out.

@ericsnowcurrently ericsnowcurrently removed their assignment Sep 19, 2019
@ericsnowcurrently ericsnowcurrently changed the title Code Adornment doesn't show for pytest in WSL Testing code lenses don't show for remote sessions to a directory symlink. Sep 19, 2019
@sammo
Copy link

sammo commented Sep 30, 2019

Same issue here. No adornments for pytest. I'm using vscode on mac Mojave and a python 3.7.3 conda environment.

@BoPeng
Copy link

BoPeng commented Jun 3, 2020

Same here, I do not know what is WSL ad I do not have any symbolic link in the path. I am in conda python 3.8 environment under mac catalina.

Edit: I really do not know what happened, these Run Test adornments suddenly appeared.

@brettcannon
Copy link
Member

In our upcoming test provider we won't have codelenses, but there will be gutter icons which do work under e.g. WSL.

@brettcannon brettcannon added the verified Verification succeeded label Jul 29, 2021
@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 16, 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.

6 participants