aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-11-16 19:59:10 +0100
committerGitHub <noreply@github.com>2022-11-16 19:59:10 +0100
commit6600d2af20fc8df1765fbc68283de2a4da17e190 (patch)
tree25c20c57ba65f62d8c603fd977e6cb990b3f315c /tests/mason-core
parentchore: update generated code (#669) (diff)
downloadmason-6600d2af20fc8df1765fbc68283de2a4da17e190.tar
mason-6600d2af20fc8df1765fbc68283de2a4da17e190.tar.gz
mason-6600d2af20fc8df1765fbc68283de2a4da17e190.tar.bz2
mason-6600d2af20fc8df1765fbc68283de2a4da17e190.tar.lz
mason-6600d2af20fc8df1765fbc68283de2a4da17e190.tar.xz
mason-6600d2af20fc8df1765fbc68283de2a4da17e190.tar.zst
mason-6600d2af20fc8df1765fbc68283de2a4da17e190.zip
feat(pip): add setting to upgrade pip before installing packages (#671)
Closes #616.
Diffstat (limited to 'tests/mason-core')
-rw-r--r--tests/mason-core/managers/pip3_spec.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/mason-core/managers/pip3_spec.lua b/tests/mason-core/managers/pip3_spec.lua
index ffba9b04..601ee839 100644
--- a/tests/mason-core/managers/pip3_spec.lua
+++ b/tests/mason-core/managers/pip3_spec.lua
@@ -13,6 +13,10 @@ local spawn = require "mason-core.spawn"
local api = require "mason-registry.api"
describe("pip3 manager", function()
+ before_each(function()
+ settings.set(settings._DEFAULT_SETTINGS)
+ end)
+
it("normalizes pip3 packages", function()
local normalize = pip3.normalize_package
assert.equals("python-lsp-server", normalize "python-lsp-server[all]")
@@ -117,6 +121,7 @@ describe("pip3 manager", function()
local handle = InstallHandleGenerator "dummy"
local ctx = InstallContextGenerator(handle)
installer.run_installer(ctx, pip3.packages { "package" })
+ assert.spy(ctx.spawn.python).was_called(1)
assert.spy(ctx.spawn.python).was_called_with {
"-m",
"pip",
@@ -131,6 +136,42 @@ describe("pip3 manager", function()
)
it(
+ "should upgrade pip",
+ async_test(function()
+ settings.set {
+ pip = {
+ upgrade_pip = true,
+ },
+ }
+ local handle = InstallHandleGenerator "dummy"
+ local ctx = InstallContextGenerator(handle)
+ installer.run_installer(ctx, pip3.packages { "package" })
+ vim.pretty_print(ctx.spawn.python)
+ assert.spy(ctx.spawn.python).was_called(2)
+ assert.spy(ctx.spawn.python).was_called_with {
+ "-m",
+ "pip",
+ "--disable-pip-version-check",
+ "install",
+ "-U",
+ {},
+ "pip",
+ with_paths = { path.concat { path.package_prefix "dummy", "venv", "bin" } },
+ }
+ assert.spy(ctx.spawn.python).was_called_with {
+ "-m",
+ "pip",
+ "--disable-pip-version-check",
+ "install",
+ "-U",
+ {},
+ { "package" },
+ with_paths = { path.concat { path.package_prefix "dummy", "venv", "bin" } },
+ }
+ end)
+ )
+
+ it(
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"