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

VSCode not running discovered PyTest tests when path contains a symlink #17573

Closed
Tracked by #19791
Mithrandir2k18 opened this issue Sep 30, 2021 · 3 comments
Closed
Tracked by #19791
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug

Comments

@Mithrandir2k18
Copy link

Mithrandir2k18 commented Sep 30, 2021

Environment data

  • VS Code version: code --version
    1.60.2
    7f6ab5485bbc008386c4386d08766667e155244e
    x64
  • Extension version (available under the Extensions sidebar): v2021.9.1246542782
  • OS and version: Ubuntu 20.04 5.4.0-84-generic
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.10
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: Pytest 6.2.5
  • Relevant/affected Python-related VS Code extensions and their versions: (probably unrelated) Pylance v2021.9.4
  • Value of the python.languageServer setting: Pylance

Expected behaviour

Run discovered Tests when running all tests.

Actual behaviour

Tests are discovered correctly but doing Run All Tests will turn the icons blue briefly and then return to the state before running them (gray circle with black box in the middle) almost instantly.

Steps to reproduce:

  1. create a folder called e.g. repositories
  2. checkout out any python project containing a test-folder with pytest tests
  3. verify these tests run using the discover tests and run all tests features
  4. move the repository folder to a different path(in my case a path on a different drive)
  5. create a symlink using ln -s /new/path/to/repositories /old/path/to/repositories
  6. verify your symlink is correct by either ls -l or by doing cd /old/path/to/repositories
  7. start vscode with the path containing the symlink so cd /old/path/to/repositories/code_repo && code .
  8. Tests are discovered correctly but doing Run All Tests will turn the icons blue briefly and then return to the state before running them (gray circle with black box in the middle) almost instantly.
  9. Close VSCode and cd into the repo without a symlink in the path(cd /new/path/to/repositories/code_repo && code .
  10. Tests now run again!

Logs

Sadly not output whatsoever, the only indication of clicking on runalltests(or using ctrl+shift+p to do it) is the briefly blue-flashing icons next to the tests.

This is the Output -> Python output but as mentioned above, doesn't seem relevant:

User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'pythonDeprecatePythonPath'
User belongs to experiment group 'pythonSortEnvs'
User belongs to experiment group 'pythonRunFailedTestsButtonDisplayed'
User belongs to experiment group 'pythonRefreshTestsButtonDisplayed'
User belongs to experiment group 'pythonRememberDebugConfig'
Python interpreter path: /usr/bin/python3
Starting Pylance language server.
@Mithrandir2k18 Mithrandir2k18 added bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team labels Sep 30, 2021
@karthiknadig karthiknadig self-assigned this Sep 30, 2021
@karthiknadig karthiknadig added area-testing triage and removed triage-needed Needs assignment to the proper sub-team labels Sep 30, 2021
@cbini
Copy link

cbini commented Oct 1, 2021

Same issue breaks Pylance as well. This morning, I added a symlink to my home directory on WSL (unrelated to any project repo) and noticed the linter was broken. Found this issue, deleted the symlink, and it starts working again immediately.

@salu133445
Copy link

Ran into this issue as well. Linting and testing broke if I opened the folder with a symlink in its path.

@karthiknadig karthiknadig added triage-needed Needs assignment to the proper sub-team and removed triage labels May 4, 2022
@karthiknadig karthiknadig added needs PR Ready to be worked on and removed triage-needed Needs assignment to the proper sub-team labels Sep 15, 2022
@eleanorjboyd
Copy link
Member

Consolidating all issues on testing and symlinks to issue #9347. Let me know if you do not think this other issue is representative of the bug you are facing. Thanks!

@github-actions github-actions bot removed the needs PR Ready to be worked on label Jul 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2023
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
Projects
None yet
Development

No branches or pull requests

5 participants