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

Fix python::virtualenv to allow virtualenv to not require absolute path #592

Merged
merged 2 commits into from
Dec 13, 2020
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
2 changes: 1 addition & 1 deletion manifests/virtualenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
Integer $timeout = 1800,
String $pip_args = '',
String $extra_pip_args = '',
Optional[Stdlib::Absolutepath] $virtualenv = undef,
Optional[String[1]] $virtualenv = undef,
) {
include python

Expand Down
42 changes: 42 additions & 0 deletions spec/defines/virtualenv_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
require 'spec_helper'

describe 'python::virtualenv', type: :define do
on_supported_os.each do |os, facts|
next if os == 'gentoo-3-x86_64'
context "on #{os}" do
let :facts do
facts
end
let :title do
'/opt/env'
end

context 'with default parameters' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_file('/opt/env') }
it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('virtualenv --no-site-packages -p python /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --proxy= --upgrade pip && /opt/env/bin/pip install --proxy= --upgrade distribute') }
end

context 'when virtualenv is defined' do
let(:params) {{ virtualenv: 'virtualenv-3' }}

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command(%r{virtualenv-3 --no-site-packages -p python .+}) }
end

describe 'when ensure' do
context 'is absent' do
let :params do
{
ensure: 'absent'
}
end

it {
is_expected.to contain_file('/opt/env').with_ensure('absent').with_purge(true)
}
end
end
end # context
end
end