diff options
| author | Can Eldem <celdem@gitlab.com> | 2020-06-08 12:16:35 +0000 |
|---|---|---|
| committer | Can Eldem <celdem@gitlab.com> | 2020-06-08 12:16:35 +0000 |
| commit | 5eef2e4c1a5c28f4e2b8e48e4701dae56264a979 (patch) | |
| tree | f853dc1c8601fb4222908f2ce8d4e03880367db3 /spec/integration/python | |
| parent | 12ef778891c4bf9fae19ffdc9d566fc7ab309957 (diff) | |
| parent | 55d3e5288826e21286054ed7cbaaec15e037f1dd (diff) | |
Merge branch 'asdf-java-version' into 'master'v3.11.2
Load the configured version of Java/Python
See merge request gitlab-org/security-products/license-management!163
Diffstat (limited to 'spec/integration/python')
| -rw-r--r-- | spec/integration/python/pip_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/integration/python/pip_spec.rb b/spec/integration/python/pip_spec.rb index 0ba3d0e..e808188 100644 --- a/spec/integration/python/pip_spec.rb +++ b/spec/integration/python/pip_spec.rb @@ -157,4 +157,46 @@ setup( expect(report.licenses_for('requests')).to match_array(['Apache-2.0']) end end + + context "when specifying the version of Python using environment variables" do + let(:output_file) { Pathname.new(runner.project_path.join('output.txt')) } + + before do + runner.add_file('custom.sh') do + <<~SCRIPT + #!/bin/bash -l + + python --version &> '#{output_file}' + SCRIPT + end + end + + it 'prioritizes `LM_PYTHON_VERSION` over the `ASDF_PYTHON_VERSION`' do + runner.scan(env: { + 'ASDF_PYTHON_VERSION' => '3.8.2', + 'LM_PYTHON_VERSION' => '2.7.18', + 'SETUP_CMD' => 'bash custom.sh' + }) + + expect(output_file).to exist + expect(output_file.read).to include('2.7.18') + end + + it 'reads the ASDF_PYTHON_VERSION' do + runner.scan(env: { + 'ASDF_PYTHON_VERSION' => '3.8.2', + 'SETUP_CMD' => 'bash custom.sh' + }) + + expect(output_file).to exist + expect(output_file.read).to include('3.8.2') + end + + it 'defaults to Python 3' do + runner.scan(env: { 'SETUP_CMD' => 'bash custom.sh' }) + + expect(output_file).to exist + expect(output_file.read).to include('3.8.2') + end + end end |
