Skip to content

Test Python venv auto-creation (e2e)#13742

Open
rodrigosf672 wants to merge 3 commits into
mainfrom
test/venv-creation-e2e-tests
Open

Test Python venv auto-creation (e2e)#13742
rodrigosf672 wants to merge 3 commits into
mainfrom
test/venv-creation-e2e-tests

Conversation

@rodrigosf672
Copy link
Copy Markdown
Member

@rodrigosf672 rodrigosf672 commented May 23, 2026

Summary

  • E2E Playwright tests for the venv auto-creation notification flow
  • Notification appears for workspace with requirements.txt and no .venv
  • No notification when .venv already exists
  • Clicking Yes creates the environment

Depends on posit-dev/qa-example-content#138.

Addresses #13437 (e2e layer). I focused on writing less e2e tests here to prevent furthering pressure against the CI, hence why this e2e test suite is quite minimal.

Test plan

  • Merge qa-example-content fixtures first
  • npx playwright test python-venv-creation --project e2e-electron passes locally
  • CI passes (it will fail now since files need to be added).

@:interpreter @:win @:web

Covers the user-visible flow: notification appears when workspace has
requirements.txt without .venv, no notification when .venv exists,
and clicking Yes creates the environment.

Requires workspace fixtures in qa-example-content/workspaces/python-venv-creation/.

Closes #13437 (e2e test layer)
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 23, 2026

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:interpreter @:win @:web

readme  valid tags

@rodrigosf672 rodrigosf672 marked this pull request as draft May 23, 2026 01:08
Signed-off-by: Rodrigo Silva Ferreira <129895386+rodrigosf672@users.noreply.github.com>
@rodrigosf672 rodrigosf672 requested a review from Copilot May 26, 2026 20:21
@rodrigosf672 rodrigosf672 marked this pull request as ready for review May 26, 2026 20:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a minimal Playwright e2e spec under the existing test/e2e harness to cover the Python “auto-create .venv” notification flow when dependency files (e.g. requirements.txt) are present.

Changes:

  • Adds an interpreter-focused e2e test suite asserting the auto-create prompt appears for a workspace with requirements.txt.
  • Adds coverage for the “no prompt when .venv already exists” case.
  • Adds coverage for accepting the prompt (“Yes”) and verifying a .venv directory is created.

Comment on lines +30 to +32
}, async function ({ app, openFolder }) {
await openFolder(path.join(fixtureBase, 'with-requirements'));

Comment on lines +39 to +42
// Reload to reset the run-once guard from prior test
await hotKeys.reloadWindow(true);
await openFolder(path.join(fixtureBase, 'with-existing-venv'));

Comment on lines +50 to +53

const tempWorkspace = '/tmp/vscsmoke/qa-example-content/venv-creation-test';
await fs.mkdir(tempWorkspace, { recursive: true });
await fs.writeFile(path.join(tempWorkspace, 'requirements.txt'), 'requests\n');
await app.workbench.toasts.expectToastWithTitleNotToAppear(/requirements\.txt/);
});

test('Clicking Yes creates venv and installs deps', {
Address review feedback:
- Replace path.join with template literals for openFolder paths to
  avoid backslashes on Windows (openFolder splits on '/')
- Use os.tmpdir() instead of hardcoded /tmp for cross-platform support
- Rename test to match actual assertions (venv creation, not deps install)
- Add test.slow() and increase notification timeout to 60s for CI stability

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants