Skip to content

Add automated tests for interpreter resolution#720

Merged
edvilme merged 5 commits into
mainfrom
add-interpreter-resolution-tests
Mar 2, 2026
Merged

Add automated tests for interpreter resolution#720
edvilme merged 5 commits into
mainfrom
add-interpreter-resolution-tests

Conversation

@edvilme
Copy link
Copy Markdown
Contributor

@edvilme edvilme commented Mar 2, 2026

Summary

Adds unit tests for the interpreter resolution logic introduced in the Python Environments extension integration.

Tests Added

# Test Description
1 Finds interpreter using Python Environments extension Mocks ms-python.vscode-python-envs, verifies getInterpreterDetails returns the correct path and that the legacy API is not called
2 Finds interpreter using legacy ms-python.python extension Envs extension absent, verifies fallback to PythonExtension.api() and correct path resolution

Changes

  • src/common/python.ts — Added _resetForTesting() export to clear cached _api and _envsApi between tests
  • src/test/ts_tests/tests/common/python.unit.test.ts — New test file with 2 Mocha TDD tests using sinon stubs and chai assertions

Test 1: Finds interpreter using Python Environments extension
Test 2: Finds interpreter using legacy ms-python.python extension
Adds _resetForTesting() to clear cached API references between tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@edvilme edvilme added the debt Technical debt or repo cleanup label Mar 2, 2026
rchiodo
rchiodo previously approved these changes Mar 2, 2026
Copy link
Copy Markdown
Contributor

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

Approved via Review Center.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@edvilme edvilme requested a review from rchiodo March 2, 2026 23:22
@edvilme edvilme enabled auto-merge (squash) March 2, 2026 23:29
edvilme and others added 3 commits March 2, 2026 15:32
Verifies that Python 3.8 (below minimum 3.10) is rejected by the envs
extension path and does not fall through to legacy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verifies that Python 3.8 from the legacy ms-python.python extension is
rejected when it fails the minimum version check (3.10+).

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

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

Approved via Review Center.

@edvilme edvilme merged commit 18c588d into main Mar 2, 2026
20 checks passed
@edvilme edvilme deleted the add-interpreter-resolution-tests branch March 2, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Technical debt or repo cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants