Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added python 3.12 support #125

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -21,8 +22,8 @@ LATEST_36="3.6.15"
LATEST_35="3.5.10"
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} ${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} ${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))"* ]]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nesse teste usando PYTHON_VERSION=3 não deveria pegar a ultima versão do python3, que agora seria a 3.12.0?

Suggested change
[[ "$output" == *"Using python version: 3.11.3 (PYTHON_VERSION environment variable (closest))"* ]]
[[ "$output" == *"Using python version: 3.12.0 (PYTHON_VERSION environment variable (closest))"* ]]

export PYTHON_VERSION=3.11.3
run python --version

assert_success
Expand Down
Loading