Skip to content

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

Closed

Description

@yphillip

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 (View→Output, 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

Activity

  1. added
    triage-neededNeeds assignment to the proper sub-team
    bugIssue identified by VS Code Team member as probable bug
    on Sep 17, 2019
  2. yphillip commented on Sep 17, 2019

    @yphillip
    Author
  3. yphillip commented on Sep 17, 2019

    @yphillip
    Author

    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.

  4. yphillip commented on Sep 18, 2019

    @yphillip
    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.

  5. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Sep 18, 2019
  6. ericsnowcurrently commented on Sep 19, 2019

    @ericsnowcurrently

    Thanks for letting us know about this, Phillip Yen (@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).

  7. ericsnowcurrently commented on Sep 19, 2019

    @ericsnowcurrently

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

  8. 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.[/+] on Sep 19, 2019
  9. sammo commented on Sep 30, 2019

    @sammo

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

  10. BoPeng commented on Jun 3, 2020

    @BoPeng

    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.

  11. brettcannon commented on Jul 29, 2021

    @brettcannon
    Member

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

  12. locked as resolved and limited conversation to collaborators on Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-testingbugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions