Skip to content

Commit

Permalink
test: check plugin dependencies with python and pipx. (#2109)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adirelle authored May 14, 2024
1 parent 71f5480 commit eeecfc1
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
36 changes: 36 additions & 0 deletions e2e/forge/test_pipx_deep_dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# shellcheck shell=bash disable=SC2016,SC2034

# Create system "tools" that always fail and push them to the front of PATH
cat >"$HOME/bin/fail" <<'EOF'
#!/usr/bin/env bash
echo "CALL TO SYSTEM $(basename $0)! args: $*" >&2
exit 1
EOF
chmod +x "$HOME"/bin/fail
for TOOL in python python3 pipx; do
ln -s fail "$HOME/bin/$TOOL"
done
export PATH="$HOME/bin:$PATH"

# Just to be sure...
assert_fail "python"
assert_fail "python3"
assert_fail "pipx"

# Use only precompiled python
export MISE_PYTHON_COMPILE=0

# Set up a 3-step installation: python@3.12.3 > pipx@1.5.0 > pipx:mkdocs@1.6.0
cat >.mise.toml <<EOF
[tools]
python = "3.12.3"
pipx = "1.5.0"
"pipx:mkdocs" = "1.6.0"
EOF

# Install the tools
mise install

# Assert that mkdocs 1.6.0 has been installed with pipx and uses python 3.12
# (mkdocs conveniently returns its installation path in with --version)
assert_contains "mise x -- mkdocs --version" "/mise/installs/pipx-mkdocs/1.6.0/venvs/mkdocs/lib/python3.12/"
31 changes: 31 additions & 0 deletions e2e/forge/test_pipx_direct_dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# shellcheck shell=bash
require_cmd "python"

# Create a system pipx that always fail and push it to the front of PATH
cat >"$HOME/bin/pipx" <<'EOF'
#!/usr/bin/env bash
echo "CALL TO SYSTEM pipx! args: $*" >&2
exit 1
EOF
chmod +x "$HOME"/bin/pipx
export PATH="$HOME/bin:$PATH"

# Just to be sure...
assert_fail "pipx"

# Use precompiled python
export MISE_PYTHON_COMPILE=0

# Set up a 2-step installation: pipx@1.5.0 > pipx:mkdocs@1.6.0
cat >.mise.toml <<EOF
[tools]
pipx = "1.5.0"
"pipx:mkdocs" = "1.6.0"
EOF

# Install the tools
mise install

# Assert that mkdocs 1.6.0 has been installed with pipx
# (mkdocs conveniently returns its installation path in with --version)
assert_contains "mise x -- mkdocs --version" "/mise/installs/pipx-mkdocs/1.6.0/"

0 comments on commit eeecfc1

Please sign in to comment.