Skip to content

Conversation

@karthiknadig
Copy link
Member

@karthiknadig karthiknadig commented Feb 18, 2021

For #15439

This is a special case for pyenv where the env dirs are listed a symbolic links. To add tests for this scenario we need to bring up the virutal FS test framework so we can use declarative test file layout for things like symbolic links and other OS and FS specific things.

@karthiknadig karthiknadig added the skip tests Updates to tests unnecessary label Feb 18, 2021
Copy link

@karrtikr karrtikr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but few concerns,

  • Why has this problem only started appearing since the last release? Is this only when in experiment? I can't seem to confirm that from the comments.
  • Is this only a special case with Pyenv, or should we fix this when listing subdirectories in other locators as well?
  • I don't recall the old locators having a problem with listing such interpreters mentioned in the issue. We used the VSCode FS API in the old locators, vs.workspace.fs.readDirectory. Maybe that doesn't have this problem.

if (stat.isDirectory()) {
yield item;
yield fullPath;
} else if (resolveSymlinks && stat.isSymbolicLink()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about symlinks which are not directories? It seems we'll be returning those as well :/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why has this problem only started appearing since the last release? Is this only when in experiment? I can't seem to confirm that from the comments.

This is only in the experiment. I don't think it is affecting the old code. There is a different problem with the old code.

Is this only a special case with Pyenv, or should we fix this when listing subdirectories in other locators as well?

As far as I can tell this is a special case with Pyenvs. pyenv seems to optimize things this way.

I don't recall the old locators having a problem with listing such interpreters mentioned in the issue. We used the VSCode FS API in the old locators, vs.workspace.fs.readDirectory. Maybe that doesn't have this problem.

That is right vs.workspace.fs.readDirectory reads symlinks and resolves them for directories.

What about symlinks which are not directories?

Good catch. I will update the conde to handle that case.

Copy link

@karrtikr karrtikr Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

As far as I can tell this is a special case with Pyenvs. pyenv seems to optimize things this way.

We know vs.workspace.fs.readDirectory which reads symlinks and resolves them for directories works well for old virtual env locators that we had.
So I think we should also pass resolveSymlinks as true for other virtual env locators as well to be safe.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created a work item corresponding to the precautionary comment I made above.

@karrtikr karrtikr changed the title Ensure pyenv virtual envs are not skipped Ensure pyenv virtual envs are not skipped when in discovery experiment Feb 19, 2021
@codecov-io
Copy link

Codecov Report

Merging #15451 (69c71e8) into main (cbdbe0a) will decrease coverage by 0%.
The diff coverage is 23%.

@@          Coverage Diff           @@
##            main   #15451   +/-   ##
======================================
- Coverage     65%      65%   -1%     
======================================
  Files        560      561    +1     
  Lines      26926    26959   +33     
  Branches    3900     3913   +13     
======================================
- Hits       17535    17531    -4     
- Misses      8666     8700   +34     
- Partials     725      728    +3     
Impacted Files Coverage Δ
...nments/discovery/locators/services/pyenvLocator.ts 69% <0%> (ø)
.../pythonEnvironments/common/externalDependencies.ts 64% <35%> (-6%) ⬇️
...sting/common/services/unitTestDiagnosticService.ts 80% <0%> (-16%) ⬇️
src/client/testing/common/types.ts 93% <0%> (-7%) ⬇️
...nts/base/locators/composite/environmentsReducer.ts 94% <0%> (-3%) ⬇️
src/client/testing/pytest/main.ts 39% <0%> (-3%) ⬇️
src/client/testing/nosetest/main.ts 44% <0%> (-2%) ⬇️
src/client/testing/pytest/runner.ts 16% <0%> (-2%) ⬇️
src/client/testing/nosetest/runner.ts 16% <0%> (-2%) ⬇️
src/client/pythonEnvironments/base/locatorUtils.ts 58% <0%> (-2%) ⬇️
... and 46 more

@karthiknadig karthiknadig merged commit 4942a7b into microsoft:main Feb 19, 2021
karthiknadig added a commit to karthiknadig/vscode-python that referenced this pull request Feb 19, 2021
microsoft#15451)

* Ensure pyenv virtual envs are not skipped

* Add news

* Clean up

* Address comments
karthiknadig added a commit that referenced this pull request Mar 8, 2021
* Cherry pick fix for native notebook support into release branch (#15369)

* Fix problem with notebook apis not being used. (#15366)

* Update changelog

* Remove news file

* Add extraPaths support to JediLSP (#15365)

* Add extraPaths support

* Remove duplicate opt option

* Eslint cleanup

* Fix tests

* Ignore directories with the same name as python binaries (#15367)

* Ignore directories with the same name as pyhton binaries

* Use withFileTypes instead of lstat

* Correct pipenv activation provider when in discovery experiment (#15319)

* Correct pipenv activation provider when in discovery experiment

* Fix ESLint errors

* In PythonEnvsReducer.resolveEnv(), always fall back to the wrapped locator. (#15350)

fixes #15118

* Fix issue with missing interpreter info for some cases  (#15376)

* Use child process apis directly.

* Use raw API in process service

* Handle process cleanup

* Address sonar

* Refactor process service by pulling the raw process APIs out of the class

* Address comments

* Add reference to CVE-2020-16977 fixed in Oct 2020. (#15381)

* Fix CI failing with the number of constructor arguments error (#15347)

* Fix Command 'workbench.action.closeAllEditors' timed out failure on CI (#15322)

* Ensure environment variables provider can be created using standard classes (#15377)

* Ensure environment variables provider can be created using standard classes

* Fix unit tests

* Fix ESLint errors for environment variable provider (#15383)

* Fix problem with notebook apis not being used. (#15366)

* Show Python: Launch TensorBoard command in command palette (#15382) (#15386)

* Always register Launch TensorBoard command

* Put usage tracking behind experiment

* Cherry picks from main to release (#15421)

* Do not call activate the discovery component before registering all the classes (#15379)

* Do not attempt to activate discovery component before registering all the classes

* Add clarification comment

* Code reviews

* Skip windows store and shims paths when using known path locators (#15388)

* Skip windows store and shims paths when using known path locators

* Clean up and comments

* Tests

* Handle cases where envs variables might not be set

* Typo

Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>

Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>

* Change "Pylance not installed" prompt to allow reverting to Jedi (#15420)

* Allow on suggestion refresh by default (#15430)

Co-authored-by: Kartik Raj <karraj@microsoft.com>
Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>

* Release final (#15433)

* Version update

* Change log updates

* TPN update

* Ensure pyenv virtual envs are not skipped when in discovery experiment (#15451)

* Ensure pyenv virtual envs are not skipped

* Add news

* Clean up

* Address comments

* Register Jedi regardless of what language server is configured (#15452)

* Register Jedi regardless of what language server is configured

* News entry

* Only call component adapter behind the discovery experiment (#15459)

* Update version and change log for point release (#15463)

* Version update

* Update change log

* Update start-up telemetry for Jedi LSP (#15419) (#15571)

* Version and change log update for point release (#15572)

Co-authored-by: Rich Chiodo <rchiodo@users.noreply.github.com>
Co-authored-by: Kartik Raj <karraj@microsoft.com>
Co-authored-by: Eric Snow <eric.snow@microsoft.com>
Co-authored-by: Jim Griesmer <jimgries@microsoft.com>
Co-authored-by: Joyce Er <joyceerhuiling@gmail.com>
Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
@karthiknadig karthiknadig deleted the pyenv-virtualenv branch March 9, 2021 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip tests Updates to tests unnecessary

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants