Skip to content

Commit

Permalink
Added python 3.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelometal committed Nov 8, 2023
1 parent dc0f1a1 commit 5a4044c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ PYTHON_REPO=${PYTHON_REPO:-https://heroku-buildpack-python.s3.amazonaws.com/hero
GET_PIP_URL=${GET_PIP_URL:-https://bootstrap.pypa.io/get-pip.py}
GET_PIP_VERSION_URL=${GET_PIP_VERSION_URL:-https://bootstrap.pypa.io/pip/@VERSION@/get-pip.py}

LATEST_312="3.12.0"
LATEST_311="3.11.3"
LATEST_310="3.10.11"
LATEST_39="3.9.16"
Expand All @@ -22,8 +23,8 @@ LATEST_35="3.5.10"
LATEST_27="2.7.18"
PYPY_36="pypy3.6-7.3.2"
PYPY_27="pypy2.7-7.3.2"
LATEST_PYTHON_VERSIONS=(${LATEST_311} ${LATEST_310} ${LATEST_39} ${LATEST_38} ${LATEST_37} ${LATEST_36} ${LATEST_35} ${LATEST_27} ${PYPY_36} ${PYPY_27})
PYTHON_VERSION_DEFAULT="${PYTHON_VERSION_DEFAULT:-${LATEST_311}}"
LATEST_PYTHON_VERSIONS=(${LATEST_312} ${LATEST_311} ${LATEST_310} ${LATEST_39} ${LATEST_38} ${LATEST_37} ${LATEST_36} ${LATEST_35} ${LATEST_27} ${PYPY_36} ${PYPY_27})
PYTHON_VERSION_DEFAULT="${PYTHON_VERSION_DEFAULT:-${LATEST_312}}"
VERSION_ORIGIN="default"
PYTHON_BASE_DIR="/home/application/python"
INSTALLED_PYTHON_FILE="${PYTHON_BASE_DIR}/.installed-version"
Expand Down
19 changes: 19 additions & 0 deletions tests/python/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@ setup() {
load 'bats-support-master/load'
load 'bats-assert-master/load'

@test "use python version 3.12.0 as default" {
run /var/lib/tsuru/deploy
[[ "$output" == *"Using python version: 3.12.0"* ]]
assert_success

run python --version
assert_success
[[ "$output" == *"3.12.0"* ]]

run pip freeze
assert_success
}

@test "use python version 3.11 as default" {
export PYTHON_VERSION_DEFAULT=3.11.3
run /var/lib/tsuru/deploy
[[ "$output" == *"Using python version: 3.11.3"* ]]
assert_success
Expand Down Expand Up @@ -87,6 +101,7 @@ load 'bats-assert-master/load'
}

@test "use python version 3.11 as default with invalid .python-version" {
export PYTHON_VERSION=3.11.3
echo "xyz" > ${CURRENT_DIR}/.python-version
run /var/lib/tsuru/deploy
assert_success
Expand Down Expand Up @@ -164,6 +179,8 @@ EOF
}

@test "install from Pipfile.lock with custom pipenv" {
export PYTHON_REPO=${PYTHON_REPO:-https://heroku-buildpack-python.s3.amazonaws.com/heroku-18/runtimes}
export PYTHON_VERSION=2.7.18
export PYTHON_PIPENV_VERSION=2021.5.29
cp Pipfile Pipfile.lock ${CURRENT_DIR}/

Expand All @@ -180,6 +197,7 @@ EOF
}

@test "change python version" {
export PYTHON_VERSION=3.11.3
run /var/lib/tsuru/deploy
assert_success
run python --version
Expand Down Expand Up @@ -273,6 +291,7 @@ EOF
assert_success

[[ "$output" == *"Using python version: 3.11.3 (PYTHON_VERSION environment variable (closest))"* ]]
export PYTHON_VERSION=3.11.3
run python --version

assert_success
Expand Down

0 comments on commit 5a4044c

Please sign in to comment.