FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: add cross-platform package manager lifecycle coverage by edvilme · Pull Request #1717 · microsoft/vscode-python-environments · GitHub

test: add cross-platform package manager lifecycle coverage - #1717

Merged
Eduardo Villalpando Mello (edvilme) merged 22 commits into
mainfrom
package-manager-integration-coverage-feedback
Aug 24, 2026
Merged

test: add cross-platform package manager lifecycle coverage#1717
Eduardo Villalpando Mello (edvilme) merged 22 commits into
mainfrom
package-manager-integration-coverage-feedback

Conversation

Eduardo Villalpando Mello (edvilme) commented Aug 17, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Follow-up to #1704.

Summary

  • Adds shared conformance coverage for Pip, Conda, and Poetry headless package operations, ensuring failures reject without prompting or showing error UI.
  • Runs real Pip and Conda install, list, uninstall, and version-lookup coverage across the full OS/Python CI matrix.
  • Creates test-owned ephemeral venv and Conda environments in the integration suite, with ownership checks, bounded processes, and guaranteed cleanup; CI only provisions the required tools.
  • Distinguishes unsupported package version lookup with an internal PackageVersionLookupNotSupportedError. Supported profiles require a defined, non-empty result, while command, network, and parsing failures propagate.
  • Keeps Poetry lifecycle coverage explicitly deferred until CI has a controlled Poetry installation.

Validation

  • Lint, TypeScript compilation, and unit tests
  • Pip lifecycle and version lookup in a real VS Code integration host
  • Full GitHub Actions OS/Python matrix

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3fd1a810-6840-4ac9-ac33-c8a9fda4bfc4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Adds unit-level “headless conformance” coverage to ensure package manager operations (Pip/Conda/Poetry) do not prompt for interactive input or display error UI when runHeadless: true, while still rejecting on failures. Also aligns Pip’s UI entry points with the existing VS Code wrapper APIs so they can be controlled/stubbed consistently in tests.

Changes:

  • Added a shared unit test suite that exercises headless package-management behavior across Pip, Conda, and Poetry.
  • Updated PipPackageManager to use withProgress / showErrorMessage from common/window.apis instead of vscode.window directly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/test/managers/common/packageManagerHeadlessConformance.unit.test.ts New conformance unit tests asserting headless runs do not prompt and do not show error UI, while failures still reject.
src/managers/builtin/pipPackageManager.ts Switched from vscode.window to window API wrappers for progress + error UI to support headless/test stubbing.
Suppressed comments (1)

src/managers/builtin/pipPackageManager.ts:82

  • New/updated user-facing strings in this hunk (progress titles like "Installing packages" and the error UI text/button) are not localized. The repo consistently localizes UI strings via l10n.t(...) or centralized string modules (e.g., CondaStrings from src/common/localize.ts). Please localize these strings so they’re translatable.
        await withProgress(
            {
                location: ProgressLocation.Notification,
                title: 'Installing packages',
                cancellable: true,
            },

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Eduardo Villalpando Mello (edvilme) added a commit that referenced this pull request Aug 18, 2026
Keep PR #1717 focused on deterministic headless package manager conformance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: edcaaa35-9a42-4351-98fa-55bcf8f1968e
Eduardo Villalpando Mello (edvilme) force-pushed the package-manager-integration-coverage-feedback branch from 9c1c12d to e1f3481 Compare August 18, 2026 22:46
Copilot-Session: 3fd1a810-6840-4ac9-ac33-c8a9fda4bfc4

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copy link
Copy Markdown
Contributor Author

CI diagnosis and fix pushed in df6d1a2. The opt-in live-network suite introduced by #1704 fails identically on #1704, current main, and this PR: Pip version lookup returns undefined, then Conda quick-create hangs until the shared 300s Mocha timeout. Because PR #1717's intended coverage is deterministic headless conformance, the fix removes only the automatic VSC_PYTHON_PACKAGE_NETWORK_TEST invocation from PR/push workflows; it retains the tests behind their explicit opt-in gate, regular integration profile coverage, and the new deterministic unit conformance. Local validation: lint, compile-tests, 1628 unit tests, workflow YAML/Prettier, and targeted Package Manager profile coverage integration test all pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (2)

.github/workflows/pr-check.yml:337

  • The workflow no longer sets VSC_PYTHON_PACKAGE_NETWORK_TEST=1, so src/test/integration/packageManager.integration.test.ts will now always this.skip() (see line ~108) and the package-manager network integration suite won’t run in CI at all. If these tests are still intended to protect behavior, reintroduce a gated step that sets the env var (or remove/adjust the env guard and run them via an explicit job).
        if: runner.os == 'Linux'
        uses: GabrielBB/xvfb-action@86d97bde4a65fe9b290c0b3fb92c2c4ed0e5302d # v1.6
        with:
          run: npm run integration-test

      - name: Run Integration Tests (non-Linux)
        if: runner.os != 'Linux'
        run: npm run integration-test

.github/workflows/push-check.yml:336

  • The workflow no longer sets VSC_PYTHON_PACKAGE_NETWORK_TEST=1, so src/test/integration/packageManager.integration.test.ts will now always this.skip() (see line ~108) and the package-manager network integration suite won’t run on pushes either. If the suite is still required, add back a gated step that exports the env var (or migrate the tests away from env gating).
      - name: Run Integration Tests (Linux)
        if: runner.os == 'Linux'
        uses: GabrielBB/xvfb-action@86d97bde4a65fe9b290c0b3fb92c2c4ed0e5302d # v1.6
        with:
          run: npm run integration-test

      - name: Run Integration Tests (non-Linux)
        if: runner.os != 'Linux'

Stella Huang (StellaHuang95) commented Aug 18, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

🔒 Automated review in progress — Stella Huang (@StellaHuang95) is auto-reviewing this PR.

Stella Huang (StellaHuang95) added the review-auto:changes-requested Automated review: posted blocking findings to address. label Aug 18, 2026
Bypass progress UI for headless Pip, Conda, and Poetry operations while preserving refresh and error propagation. Cover post-operation refresh failures and keep live network lifecycle tests available through a manual workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: edcaaa35-9a42-4351-98fa-55bcf8f1968e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Approved via Review Center.

Stella Huang (StellaHuang95) added review-auto:approved Automated review: no blocking findings (approval posted). and removed review-auto:changes-requested Automated review: posted blocking findings to address. labels Aug 19, 2026
Enable the guarded package-manager network suites in the existing integration step for every OS and Python version, and remove the separate manual workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: edcaaa35-9a42-4351-98fa-55bcf8f1968e
Eduardo Villalpando Mello (edvilme) changed the title test: expand package manager integration coverage test: add cross-platform package manager lifecycle coverage Aug 19, 2026

Copy link
Copy Markdown
Contributor

The public package-version lookup API now rejects where it previously resolved undefined, creating a breaking consumer contract change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: edcaaa35-9a42-4351-98fa-55bcf8f1968e

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

Suppressed comments (2)

src/test/integration/environmentFixture.ts:379

  • If process-tree termination rejects, or if the force timer fires before close, this promise settles while the original child may still be running. Fixture setup then enters dispose() and can start provider/root deletion against that active process. Keep the fixture in a pending-cleanup state until child exit is confirmed (similar to the API-removal guard) instead of allowing direct cleanup after an unconfirmed kill.
            void terminateProcessTree(child).catch((error) => {
                finish(new Error(`${timeoutError.message}\nFailed to terminate process tree: ${toError(error).message}`));
            });
            forceTimer = setTimeout(() => finish(timeoutError), 10_000);

src/test/managers/builtin/pipPackageManager.unit.test.ts:133

  • This fixture still hardcodes a POSIX absolute path. On Windows, Uri.file('/path/to/environment') produces a drive-relative path, so the unit test no longer exercises the same path shape as production. Build the URI from __dirname, as the shared conformance fixture does.
            environmentPath: Uri.file('/path/to/environment'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No approval-blocking issues found. The headless package operations suppress progress/error UI while preserving operational failures, and the integration cleanup uses randomized ownership markers plus strict path-containment checks before destructive removal. I also confirmed that both PR and push CI enable the network lifecycle coverage.

Non-blocking follow-up: additional focused cleanup tests for ownership mismatch, out-of-root prefixes, partial setup, and removal timeout would strengthen the fixture coverage.

Written by an AI agent on behalf of Eleanor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: eb5f0ccb-cc13-4185-af62-e49f660c239a
return await runPython(
environment.execInfo.run.executable,
['-m', 'pip', 'list', '--format=json', ...(args ?? [])],
['-m', 'pip', 'list', '--format=json', '--disable-pip-version-check', ...(args ?? [])],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Fixes #1650

Comment thread src/test/testUtils.ts
const checkCondition = async () => {
try {
const result = await condition();
lastError = undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Warning · Non-blocking recommendation

A mixed sequence of rejection followed by false clears lastError, so rejectWithLastError emits a generic timeout instead of the operational failure. Preserve the last rejection across later false results and add a reject-then-false regression test.

[verified]

if (cleanupErrors.length > 0) {
throw new Error(cleanupErrors.map((error) => error.message).join('\n'));
}
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Warning · Non-blocking recommendation

This fixture combines provisioning, configuration, ownership enforcement, timeout handling, subprocess termination, and cleanup state, while direct unit coverage exercises only the single-flight helper. Split the bounded-process/termination machinery from the environment lease and add focused tests for ownership rejection, partial setup, removal timeout, and fallback cleanup.

[verified]

Copy link
Copy Markdown
Contributor

GitHub cannot anchor PR review comments to unchanged lines in the diff. Falling back to a general PR comment for .github/workflows/pr-check.yml:L350.

Warning · Non-blocking recommendation

Network package operations and Conda provisioning now affect every OS/Python integration job, mirrored in push-check.yml, making unrelated integration coverage dependent on external indexes and channels. Move this coverage to a dedicated package-manager matrix or otherwise bound the added network exposure.

[verified]

Copy link
Copy Markdown
Contributor

GitHub cannot anchor PR review comments to unchanged lines in the diff. Falling back to a general PR comment for src/managers/builtin/pipPackageManager.ts:L128.

Warning · Non-blocking recommendation

The headless/progress/error-notification policy is independently duplicated in the Pip, Conda, and Poetry managers. Extract a small shared operation runner so new managers cannot silently drift from the conformance contract.

[verified]

5. **✅ Validation** - Ensure coverage and resilience

## Learnings

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Info · Optional note

The learning ends with an unexplained (1) citation marker. Remove it or add the referenced footnote.

[verified]

Stella Huang (StellaHuang95) added review-auto:approved Automated review: no blocking findings (approval posted). and removed review-auto:changes-requested Automated review: posted blocking findings to address. labels Aug 24, 2026
Eduardo Villalpando Mello (edvilme) merged commit 8137950 into main Aug 24, 2026
88 of 89 checks passed
Eduardo Villalpando Mello (edvilme) deleted the package-manager-integration-coverage-feedback branch August 24, 2026 17:54

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Approved via Review Center.

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

Labels

debt Code quality issues review-auto:approved Automated review: no blocking findings (approval posted).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package list shows "No packages found" when pip emits an upgrade notice (JSON parse failure)

5 participants


Back | FazBrowse Home | New Git URL