@@ -9,9 +9,17 @@ class { 'python':
99 dev => 'present',
1010 }
1111
12+ python::pyvenv { '/opt/test-venv':
13+ ensure => 'present',
14+ systempkgs => false,
15+ mode => '0755',
16+ pip_version => '<= 20.3.4',
17+ }
18+
1219 python::pip { 'agent package':
13- pkgname => 'agent',
14- ensure => '0.1.2',
20+ virtualenv => '/opt/test-venv',
21+ pkgname => 'agent',
22+ ensure => '0.1.2',
1523 }
1624 PUPPET
1725
@@ -20,7 +28,7 @@ class { 'python':
2028 end
2129 end
2230
23- describe command ( '/usr /bin/pip list' ) do
31+ describe command ( '/opt/test-venv /bin/pip list' ) do
2432 its ( :exit_status ) { is_expected . to eq 0 }
2533 its ( :stdout ) { is_expected . to match %r{agent.* 0\. 1\. 2} }
2634 end
@@ -33,25 +41,33 @@ class { 'python':
3341 dev => 'present',
3442 }
3543
44+ python::pyvenv { '/opt/test-venv':
45+ ensure => 'present',
46+ systempkgs => false,
47+ mode => '0755',
48+ pip_version => '<= 20.3.4',
49+ }
50+
3651 python::pip { 'agent package install':
37- pkgname => 'agent',
38- ensure => '0.1.2',
52+ ensure => '0.1.2',
53+ pkgname => 'agent',
54+ virtualenv => '/opt/test-venv',
3955 }
4056
41- python::pip { 'agent package uninstall':
42- pkgname => 'agent',
57+ python::pip { 'agent package uninstall custom pkgname':
4358 ensure => 'absent',
59+ pkgname => 'agent',
60+ virtualenv => '/opt/test-venv',
4461 require => Python::Pip['agent package install'],
4562 }
4663
4764 PUPPET
4865
4966 apply_manifest ( pp , catch_failures : true )
50- apply_manifest ( pp , catch_changes : true )
5167 end
5268 end
5369
54- describe command ( '/usr /bin/pip list' ) do
70+ describe command ( '/opt/test-venv /bin/pip list' ) do
5571 its ( :exit_status ) { is_expected . to eq 0 }
5672 its ( :stdout ) { is_expected . not_to match %r{agent.* 0\. 1\. 2} }
5773 end
0 commit comments