Skip to content

Commit 7941a0c

Browse files
authored
Merge pull request #592 from treydock/virtualenv
Fix python::virtualenv to allow virtualenv to not require absolute path
2 parents 21abb33 + 2777d49 commit 7941a0c

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

manifests/virtualenv.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
Integer $timeout = 1800,
5050
String $pip_args = '',
5151
String $extra_pip_args = '',
52-
Optional[Stdlib::Absolutepath] $virtualenv = undef,
52+
Optional[String[1]] $virtualenv = undef,
5353
) {
5454
include python
5555

spec/defines/virtualenv_spec.rb

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
require 'spec_helper'
2+
3+
describe 'python::virtualenv', type: :define do
4+
on_supported_os.each do |os, facts|
5+
next if os == 'gentoo-3-x86_64'
6+
context "on #{os}" do
7+
let :facts do
8+
facts
9+
end
10+
let :title do
11+
'/opt/env'
12+
end
13+
14+
context 'with default parameters' do
15+
it { is_expected.to compile.with_all_deps }
16+
it { is_expected.to contain_file('/opt/env') }
17+
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') }
18+
end
19+
20+
context 'when virtualenv is defined' do
21+
let(:params) {{ virtualenv: 'virtualenv-3' }}
22+
23+
it { is_expected.to compile.with_all_deps }
24+
it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command(%r{virtualenv-3 --no-site-packages -p python .+}) }
25+
end
26+
27+
describe 'when ensure' do
28+
context 'is absent' do
29+
let :params do
30+
{
31+
ensure: 'absent'
32+
}
33+
end
34+
35+
it {
36+
is_expected.to contain_file('/opt/env').with_ensure('absent').with_purge(true)
37+
}
38+
end
39+
end
40+
end # context
41+
end
42+
end

0 commit comments

Comments
 (0)