Add unit tests for venv/conda create & remove orchestration#1638
Open
StellaHuang95 wants to merge 1 commit into
Open
Add unit tests for venv/conda create & remove orchestration#1638StellaHuang95 wants to merge 1 commit into
StellaHuang95 wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8f42031a-bd90-4448-bffe-b5c0ab522b6d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1624
Summary
The
create/removeorchestration inVenvManager(src/managers/builtin/venvManager.ts) andCondaEnvManager(src/managers/conda/condaEnvManager.ts) previously had no unit-level coverage of the create/remove lifecycle. While helpers such asvenvUtils.removeVenvand severalcondaEnvManagersub-behaviors (setEvents,setGlobal,findEnvironmentByPath) were unit-tested, the manager methods that tie discovery, creation, caching, and change-event firing together were only exercised indirectly via integration tests.This PR adds focused unit tests for that lifecycle, plus the minimal supporting changes needed to make those paths testable.
What changed
New tests
src/test/managers/builtin/venvManager.createRemove.unit.test.ts— coversVenvManager.create/remove:.gitignore, reveals the folder, and fires an add eventadditionalPackagesskipWatcherRefreshguard is restored even when creation/removal throwsfalseresult from the removal helper mutates nothingsrc/test/managers/conda/condaEnvManager.createRemove.unit.test.ts— coversCondaEnvManager.create/remove:.gitignoreSupporting production/test-helper changes
src/managers/builtin/venvManager.ts(4 lines): route the post-createrevealInExplorercall through the existingexecuteCommandwrapper insrc/common/command.api.tsinstead of importingcommandsfromvscodedirectly. This is a small testability refactor (the wrapper can be stubbed in unit tests) with no behavior change.src/test/mocks/pythonEnvironment.ts: add an optionalsysPrefixoverride to the shared mock helper (defaults toenvPath, so existing callers are unaffected).Testing
npm run compile-tests— clean.npm run unittest(venv/conda manager suites) — all new and existing manager tests pass. The one remaining failure in the suite (venvManager.loadEnvMap.unit.test.ts— "projectB should have its env mapped despite projectA failing") pre-exists onmainand is unrelated to this change.Notes