#!/usr/bin/env bash

export MISE_PYTHON_COMPILE=0
export MISE_PYTHON_GITHUB_ATTESTATIONS=0
# Assert the precompiled artifact was used rather than a source build. The
# filename is phase detail, which only --verbose prints per line.
assert_contains "mise use --verbose python@3.12.3 2>&1" "cpython-"
assert_contains "mise x -- python --version" "Python 3.12.3"

rm mise.toml
mise rm python@3.12.3

# Enable idiomatic version files for python
mise settings set idiomatic_version_file_enable_tools python

echo '3.12.3' >.python-version
assert_contains "mise i 2>&1" "python@3.12.3"
assert_contains "mise x -- python --version" "Python 3.12.3"

# Disable idiomatic version files for python to test override behavior
mise settings set idiomatic_version_file_enable_tools "[]"
mise use python@3.13
assert_contains "mise x -- python --version" "Python 3.13"
