Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
williamboman committed Jul 9, 2024
1 parent ff9288e commit 4945ac4
Showing 1 changed file with 27 additions and 30 deletions.
57 changes: 27 additions & 30 deletions tests/mason-core/installer/managers/pypi_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,38 +179,35 @@ 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)
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" })

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",
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
)
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()
Expand Down

0 comments on commit 4945ac4

Please sign in to comment.