mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Add a Hatchet test for python 3.8.2 (#956)
* Add a Hatchet test for python 3.8.2 * update changelog * Update test to match build output * Fix formatting and a syntax error in tests * Fix syntax error in hatchet spec
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
# Master
|
||||
|
||||
- Add a Hatchet test for python 3.8.2
|
||||
- Set Code Owners to @heroku/langauges
|
||||
- Bugfix: Caching on subsequent redeploys
|
||||
- Update tests to support latest version of Python
|
||||
|
||||
+47
-27
@@ -1,42 +1,62 @@
|
||||
require_relative '../spec_helper'
|
||||
|
||||
describe "Default Python Deploy" do
|
||||
it "🐍" do
|
||||
Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK).deploy do |app|
|
||||
|
||||
# What should happen on first deploy
|
||||
expect(app.output).to match(/Installing pip/)
|
||||
def set_python_version(d, v)
|
||||
Dir.chdir(d) do
|
||||
File.open('runtime.txt', 'w') do |f|
|
||||
f.puts "python-#{v}"
|
||||
end
|
||||
`git add runtime.txt && git commit -am "setting python version"`
|
||||
end
|
||||
end
|
||||
|
||||
# What should not happen
|
||||
expect(app.output).to_not match("Requirements file has been changed, updating cache")
|
||||
expect(app.output).to_not match("No change in requirements detected, installing from cache")
|
||||
expect(app.output).to_not match("No such file or directory")
|
||||
expect(app.output).to_not match("cp: cannot create regular file")
|
||||
before(:each) do
|
||||
set_python_version(app.directory, python_version)
|
||||
init_app(app)
|
||||
end
|
||||
|
||||
# Redeploy with changed requirements file
|
||||
run!(%Q{echo "" >> requirements.txt})
|
||||
run!(%Q{echo "flask" >> requirements.txt})
|
||||
run!(%Q{git add . ; git commit --allow-empty -m next})
|
||||
app.push!
|
||||
["3.7.6", "3.8.2"].each do |version|
|
||||
context "on python-#{version}" do
|
||||
let(:app) { Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK) }
|
||||
let(:python_version) { version }
|
||||
it "🐍" do
|
||||
app.deploy do |app|
|
||||
# What should happen on first deploy
|
||||
expect(app.output).to match(/Installing pip/)
|
||||
|
||||
# Check for the cache to have cleared
|
||||
expect(app.output).to match("Requirements file has been changed, updating cache")
|
||||
# What should not happen
|
||||
expect(app.output).to_not match("Requirements file has been changed, clearing cached dependencies")
|
||||
expect(app.output).to_not match("No change in requirements detected, installing from cache")
|
||||
expect(app.output).to_not match("No such file or directory")
|
||||
expect(app.output).to_not match("cp: cannot create regular file")
|
||||
|
||||
# What should not happen when the requirements file is changed
|
||||
expect(app.output).to_not match("No dependencies found, preparing to install")
|
||||
expect(app.output).to_not match("No change in requirements detected, installing from cache")
|
||||
# Redeploy with changed requirements file
|
||||
run!(%Q{echo "" >> requirements.txt})
|
||||
run!(%Q{echo "flask" >> requirements.txt})
|
||||
run!(%Q{git add . ; git commit --allow-empty -m next})
|
||||
app.push!
|
||||
|
||||
run!(%Q{git commit --allow-empty -m next})
|
||||
app.push!
|
||||
# Check the cache to have cleared
|
||||
expect(app.output).to match("Requirements file has been changed, clearing cached dependencies")
|
||||
|
||||
# With no changes on redeploy, the cache should
|
||||
expect(app.output).to match("No change in requirements detected, installing from cache")
|
||||
# What should not happen when the requirements file is changed
|
||||
expect(app.output).to_not match("No dependencies found, preparing to install")
|
||||
expect(app.output).to_not match("No change in requirements detected, installing from cache")
|
||||
|
||||
# With no changes on redeploy, the cache should not
|
||||
expect(app.output).to_not match("Requirements file has been changed, updating cache")
|
||||
expect(app.output).to_not match("No dependencies found, preparing to install")
|
||||
run!(%Q{git commit --allow-empty -m next})
|
||||
app.push!
|
||||
|
||||
expect(app.run('python -V')).to match(/3.7.6/)
|
||||
# With no changes on redeploy, the cache should
|
||||
expect(app.output).to match("No change in requirements detected, installing from cache")
|
||||
|
||||
# With no changes on redeploy, the cache should not
|
||||
expect(app.output).to_not match("Requirements file has been changed, clearing cached dependencies")
|
||||
expect(app.output).to_not match("No dependencies found, preparing to install")
|
||||
|
||||
expect(app.run('python -V')).to match(version)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user