diff options
| author | Inhyuk Cho <cih9088@gmail.com> | 2024-07-09 21:46:42 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-09 14:46:42 +0200 |
| commit | f96a31855fa8aea55599cea412fe611b85a874ed (patch) | |
| tree | 19fa54d6bb5aef9a4c3796c620901821bee01ada /tests | |
| parent | tests(pypi): fix assertions (#1750) (diff) | |
| download | mason-f96a31855fa8aea55599cea412fe611b85a874ed.tar mason-f96a31855fa8aea55599cea412fe611b85a874ed.tar.gz mason-f96a31855fa8aea55599cea412fe611b85a874ed.tar.bz2 mason-f96a31855fa8aea55599cea412fe611b85a874ed.tar.lz mason-f96a31855fa8aea55599cea412fe611b85a874ed.tar.xz mason-f96a31855fa8aea55599cea412fe611b85a874ed.tar.zst mason-f96a31855fa8aea55599cea412fe611b85a874ed.zip | |
fix(pypi): prefer stock python3 if it satisfies version requirement (#1736)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mason-core/installer/managers/pypi_spec.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/mason-core/installer/managers/pypi_spec.lua b/tests/mason-core/installer/managers/pypi_spec.lua index 2bd1f975..6689e350 100644 --- a/tests/mason-core/installer/managers/pypi_spec.lua +++ b/tests/mason-core/installer/managers/pypi_spec.lua @@ -179,6 +179,36 @@ describe("pypi manager", function() end ) + it("should prioritize stock python", function() + local ctx = create_dummy_context { force = true } + spy.on(ctx.stdio_sink, "stderr") + stub(ctx, "promote_cwd") + stub(ctx.fs, "file_exists") + stub(providers.pypi, "get_supported_python_versions", mockx.returns(Result.success ">=3.8")) + stub(vim.fn, "executable") + vim.fn.executable.on_call_with("python3.12").returns(1) + stub(spawn, "python3", mockx.returns(Result.success())) + spawn.python3.on_call_with({ "--version" }).returns(Result.success { stdout = "Python 3.8.0" }) + + installer.exec_in_context(ctx, function() + pypi.init { + package = { name = "cmake-language-server", version = "0.1.10" }, + upgrade_pip = true, + install_extra_args = { "--proxy", "http://localhost" }, + } + end) + + assert.spy(ctx.promote_cwd).was_called(1) + assert.spy(ctx.spawn.python3).was_called(1) + assert.spy(ctx.spawn["python3.12"]).was_called(0) + assert.spy(ctx.spawn.python3).was_called_with { + "-m", + "venv", + "--system-site-packages", + "venv", + } + end) + it("should install", function() local ctx = create_dummy_context() stub(ctx.fs, "file_exists") |
