Skip to content

Commit

Permalink
Use virtualenv for pip acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brabiega committed Apr 28, 2021
1 parent 6599b76 commit f36ea4a
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions spec/acceptance/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f36ea4a

Please sign in to comment.