diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index b62c82a0..b7d6d4e1 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -9,9 +9,17 @@ class { 'python': dev => 'present', } + python::pyvenv { '/opt/test-venv': + ensure => 'present', + systempkgs => false, + mode => '0755', + pip_version => '<= 20.3.4', + } + python::pip { 'agent package': - pkgname => 'agent', - ensure => '0.1.2', + virtualenv => '/opt/test-venv', + pkgname => 'agent', + ensure => '0.1.2', } PUPPET @@ -20,7 +28,7 @@ class { 'python': end end - describe command('/usr/bin/pip list') do + describe command('/opt/test-venv/bin/pip list') do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } end @@ -33,25 +41,33 @@ class { 'python': dev => 'present', } + python::pyvenv { '/opt/test-venv': + ensure => 'present', + systempkgs => false, + mode => '0755', + pip_version => '<= 20.3.4', + } + python::pip { 'agent package install': - pkgname => 'agent', - ensure => '0.1.2', + ensure => '0.1.2', + pkgname => 'agent', + virtualenv => '/opt/test-venv', } - python::pip { 'agent package uninstall': - pkgname => 'agent', + python::pip { 'agent package uninstall custom pkgname': ensure => 'absent', + pkgname => 'agent', + virtualenv => '/opt/test-venv', require => Python::Pip['agent package install'], } PUPPET apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) end end - describe command('/usr/bin/pip list') do + describe command('/opt/test-venv/bin/pip list') do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} } end