File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8787 default => $virtualenv ,
8888 }
8989
90+ validate_absolute_path($cwd )
91+
9092 $log = $virtualenv ? {
9193 ' system' => $log_dir ,
9294 default => $virtualenv ,
Original file line number Diff line number Diff line change 1+ require 'spec_helper_acceptance'
2+
3+ describe 'python class' do
4+
5+ context 'default parameters' do
6+ # Using puppet_apply as a helper
7+ it 'should work with no errors' do
8+ pp = <<-EOS
9+ class { 'python' :
10+ version => 'system',
11+ pip => true,
12+ virtualenv => true,
13+ }
14+ ->
15+ python::virtualenv { 'venv' :
16+ ensure => present,
17+ systempkgs => false,
18+ venv_dir => '/opt/venv',
19+ owner => 'root',
20+ group => 'root',
21+ }
22+ ->
23+ python::pip { 'rpyc' :
24+ ensure => '3.2.3',
25+ virtualenv => '/opt/venv',
26+ }
27+ EOS
28+
29+ # Run it twice and test for idempotency
30+ apply_manifest ( pp , :catch_failures => true )
31+ apply_manifest ( pp , :catch_changes => true )
32+ end
33+ end
34+ end
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe 'python::pip' , :type => :define do
4+ let ( :title ) { 'rpyc' }
5+ context "on Debian OS" do
6+ let :facts do
7+ {
8+ :id => 'root' ,
9+ :kernel => 'Linux' ,
10+ :lsbdistcodename => 'squeeze' ,
11+ :osfamily => 'Debian' ,
12+ :operatingsystem => 'Debian' ,
13+ :operatingsystemrelease => '6' ,
14+ :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
15+ :concat_basedir => '/dne' ,
16+ }
17+ end
18+
19+ describe "virtualenv as" do
20+ context "fails with non qualified path" do
21+ let ( :params ) { { :virtualenv => "venv" } }
22+ it { is_expected . to raise_error ( /"venv" is not an absolute path./ ) }
23+ end
24+ context "suceeds with qualified path" do
25+ let ( :params ) { { :virtualenv => "/opt/venv" } }
26+ it { is_expected . to contain_exec ( "pip_install_rpyc" ) . with_cwd ( '/opt/venv' ) }
27+ end
28+ context "defaults to system" do
29+ let ( :params ) { { } }
30+ it { is_expected . to contain_exec ( "pip_install_rpyc" ) . with_cwd ( '/' ) }
31+ end
32+ end
33+ end
34+ end
You can’t perform that action at this time.
0 commit comments