Skip to content
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
1 change: 0 additions & 1 deletion lib/poetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ function poetry::install_poetry() {
# Force Poetry to manage the system Python site-packages instead of using venvs.
export POETRY_VIRTUALENVS_CREATE="false"
# Force Poetry to use our Python rather than scanning PATH (which might pick system Python).
# Though this currently doesn't work as documented: https://github.com/python-poetry/poetry/issues/10226
export POETRY_VIRTUALENVS_USE_POETRY_PYTHON="true"

# Set the same env vars in the environment used by later buildpacks.
Expand Down
33 changes: 20 additions & 13 deletions spec/hatchet/poetry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,21 +379,28 @@
end
end

# This is disabled since it's currently broken upstream: https://github.com/python-poetry/poetry/issues/10226
# This tests that Poetry doesn't download its own Python or fall back to system Python
# if the Python version in pyproject.toml doesn't match that in .python-version.
# context 'when requires-python in pyproject.toml is incompatible with .python-version' do
# let(:app) { Hatchet::Runner.new('spec/fixtures/poetry_mismatched_python_version', allow_failure: true) }
#
# it 'fails the build' do
# app.deploy do |app|
# expect(clean_output(app.output)).to include(<<~OUTPUT)
# remote: -----> Installing dependencies using 'poetry sync --only main'
# remote: <TODO whatever error message Poetry displays if they fix their bug>
# OUTPUT
# end
# end
# end
context 'when requires-python in pyproject.toml is incompatible with .python-version' do
let(:app) { Hatchet::Runner.new('spec/fixtures/poetry_mismatched_python_version', allow_failure: true) }

it 'fails the build' do
app.deploy do |app|
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Installing dependencies using 'poetry sync --only main'
remote:
remote: Current Python version (#{LATEST_PYTHON_3_13}) is not allowed by the project (3.12.*).
remote: Poetry cannot switch to a compatible Python version because virtualenv creation is disabled.
remote:
remote: ! Error: Unable to install dependencies using Poetry.
remote: !
remote: ! See the log output above for more information.
remote:
remote: ! Push rejected, failed to compile Python app.
OUTPUT
end
end
end

# This tests not only our handling of failing dependency installation, but also that we're running
# Poetry in such a way that it errors if the lockfile is out of sync, rather than simply updating it.
Expand Down