|
20 | 20 | end |
21 | 21 | end |
22 | 22 |
|
| 23 | +RSpec.shared_examples 'aborts the build with a runtime not available message (Pipenv)' do |requested_version| |
| 24 | + it 'aborts the build with a runtime not available message' do |
| 25 | + app.deploy do |app| |
| 26 | + expect(clean_output(app.output)).to include(<<~OUTPUT) |
| 27 | + remote: -----> Python app detected |
| 28 | + remote: -----> Using Python version specified in Pipfile.lock |
| 29 | + remote: ! Requested runtime (python-#{requested_version}) is not available for this stack (#{app.stack}). |
| 30 | + remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support |
| 31 | + OUTPUT |
| 32 | + end |
| 33 | + end |
| 34 | +end |
| 35 | + |
23 | 36 | RSpec.describe 'Pipenv support' do |
24 | 37 | context 'without a Pipfile.lock' do |
25 | 38 | let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_no_lockfile') } |
|
85 | 98 | end |
86 | 99 | end |
87 | 100 |
|
88 | | - context 'when using Heroku-20', stacks: %w[heroku-20] do |
| 101 | + context 'when using Heroku-20 or newer', stacks: %w[heroku-20 heroku-22] do |
89 | 102 | let(:allow_failure) { true } |
90 | 103 |
|
91 | | - it 'fails the build' do |
92 | | - # Python 2.7 is EOL, so it has not been built for Heroku-20. |
93 | | - app.deploy do |app| |
94 | | - expect(clean_output(app.output)).to include(<<~OUTPUT) |
95 | | - remote: -----> Python app detected |
96 | | - remote: -----> Using Python version specified in Pipfile.lock |
97 | | - remote: ! Requested runtime (python-#{LATEST_PYTHON_2_7}) is not available for this stack (#{app.stack}). |
98 | | - remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support |
99 | | - OUTPUT |
100 | | - end |
101 | | - end |
| 104 | + # Python 2.7 is EOL, so has not been built for newer stacks. |
| 105 | + include_examples 'aborts the build with a runtime not available message (Pipenv)', LATEST_PYTHON_2_7 |
102 | 106 | end |
103 | 107 | end |
104 | 108 |
|
|
112 | 116 | end |
113 | 117 |
|
114 | 118 | context 'with a Pipfile.lock containing python_version 3.6' do |
115 | | - let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.6') } |
| 119 | + let(:allow_failure) { false } |
| 120 | + let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.6', allow_failure: allow_failure) } |
116 | 121 |
|
117 | | - it 'builds with the latest Python 3.6' do |
118 | | - app.deploy do |app| |
119 | | - expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX)) |
120 | | - remote: -----> Python app detected |
121 | | - remote: -----> Using Python version specified in Pipfile.lock |
122 | | - remote: cp: cannot stat '/tmp/build_.*/requirements.txt': No such file or directory |
123 | | - remote: -----> Installing python-#{LATEST_PYTHON_3_6} |
124 | | - remote: -----> Installing pip 21.3.1, setuptools 59.6.0 and wheel 0.37.1 |
125 | | - remote: -----> Installing dependencies with Pipenv 2020.11.15 |
126 | | - remote: Installing dependencies from Pipfile.lock \\(.*\\)... |
127 | | - remote: -----> Installing SQLite3 |
128 | | - REGEX |
| 122 | + context 'when using Heroku-18 or Heroku-20', stacks: %w[heroku-18 heroku-20] do |
| 123 | + it 'builds with the latest Python 3.6' do |
| 124 | + app.deploy do |app| |
| 125 | + expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX)) |
| 126 | + remote: -----> Python app detected |
| 127 | + remote: -----> Using Python version specified in Pipfile.lock |
| 128 | + remote: cp: cannot stat '/tmp/build_.*/requirements.txt': No such file or directory |
| 129 | + remote: -----> Installing python-#{LATEST_PYTHON_3_6} |
| 130 | + remote: -----> Installing pip 21.3.1, setuptools 59.6.0 and wheel 0.37.1 |
| 131 | + remote: -----> Installing dependencies with Pipenv 2020.11.15 |
| 132 | + remote: Installing dependencies from Pipfile.lock \\(.*\\)... |
| 133 | + remote: -----> Installing SQLite3 |
| 134 | + REGEX |
| 135 | + end |
129 | 136 | end |
130 | 137 | end |
| 138 | + |
| 139 | + context 'when using Heroku-22', stacks: %w[heroku-22] do |
| 140 | + let(:allow_failure) { true } |
| 141 | + |
| 142 | + # Python 3.6 is EOL, so has not been built for newer stacks. |
| 143 | + include_examples 'aborts the build with a runtime not available message (Pipenv)', LATEST_PYTHON_3_6 |
| 144 | + end |
131 | 145 | end |
132 | 146 |
|
133 | 147 | context 'with a Pipfile.lock containing python_version 3.7' do |
134 | | - let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.7') } |
| 148 | + let(:allow_failure) { false } |
| 149 | + let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.7', allow_failure: allow_failure) } |
135 | 150 |
|
136 | | - include_examples 'builds using Pipenv with the requested Python version', LATEST_PYTHON_3_7 |
| 151 | + context 'when using Heroku-18 or Heroku-20', stacks: %w[heroku-18 heroku-20] do |
| 152 | + include_examples 'builds using Pipenv with the requested Python version', LATEST_PYTHON_3_7 |
| 153 | + end |
| 154 | + |
| 155 | + context 'when using Heroku-22', stacks: %w[heroku-22] do |
| 156 | + let(:allow_failure) { true } |
| 157 | + |
| 158 | + # Python 3.7 is in the security fix only stage of its lifecycle, so has not been built for newer stacks. |
| 159 | + include_examples 'aborts the build with a runtime not available message (Pipenv)', LATEST_PYTHON_3_7 |
| 160 | + end |
137 | 161 | end |
138 | 162 |
|
139 | 163 | context 'with a Pipfile.lock containing python_version 3.8' do |
140 | | - let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.8') } |
| 164 | + let(:allow_failure) { false } |
| 165 | + let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.8', allow_failure: allow_failure) } |
141 | 166 |
|
142 | | - include_examples 'builds using Pipenv with the requested Python version', LATEST_PYTHON_3_8 |
| 167 | + context 'when using Heroku-18 or Heroku-20', stacks: %w[heroku-18 heroku-20] do |
| 168 | + include_examples 'builds using Pipenv with the requested Python version', LATEST_PYTHON_3_8 |
| 169 | + end |
| 170 | + |
| 171 | + context 'when using Heroku-22', stacks: %w[heroku-22] do |
| 172 | + let(:allow_failure) { true } |
| 173 | + |
| 174 | + # Python 3.8 is in the security fix only stage of its lifecycle, so has not been built for newer stacks. |
| 175 | + include_examples 'aborts the build with a runtime not available message (Pipenv)', LATEST_PYTHON_3_8 |
| 176 | + end |
143 | 177 | end |
144 | 178 |
|
145 | 179 | context 'with a Pipfile.lock containing python_version 3.9' do |
|
0 commit comments