Switch to built-in venv
Python provides the built-in venv functionality which can replace virtualenv since Python 3.3 . Depends-on: https://review.opendev.org/934007 Change-Id: I201684c953e30f6e148573ee0340e1807518de70
This commit is contained in:
parent
523925be0d
commit
f41a63ebce
@ -581,20 +581,6 @@ class tempest(
|
|||||||
ensure_packages(['git'])
|
ensure_packages(['git'])
|
||||||
ensure_packages($tempest::params::dev_packages)
|
ensure_packages($tempest::params::dev_packages)
|
||||||
|
|
||||||
if $::tempest::params::pip_package_name {
|
|
||||||
ensure_packages('pip', {
|
|
||||||
name => $::tempest::params::pip_package_name,
|
|
||||||
})
|
|
||||||
Package['pip'] -> Package['tox']
|
|
||||||
} else {
|
|
||||||
warning('pip package is not available in this distribution.')
|
|
||||||
}
|
|
||||||
|
|
||||||
package { 'tox':
|
|
||||||
ensure => present,
|
|
||||||
provider => 'pip',
|
|
||||||
}
|
|
||||||
|
|
||||||
if $git_clone {
|
if $git_clone {
|
||||||
vcsrepo { $tempest_clone_path:
|
vcsrepo { $tempest_clone_path:
|
||||||
ensure => 'present',
|
ensure => 'present',
|
||||||
@ -608,13 +594,11 @@ class tempest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if $setup_venv {
|
if $setup_venv {
|
||||||
# virtualenv will be installed along with tox
|
|
||||||
exec { 'create-venv':
|
exec { 'create-venv':
|
||||||
command => ['virtualenv', '-p', 'python3', "${tempest_clone_path}/.venv"],
|
command => ['python3', '-m', 'venv', "${tempest_clone_path}/.venv"],
|
||||||
creates => "${tempest_clone_path}/.venv",
|
creates => "${tempest_clone_path}/.venv",
|
||||||
path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
||||||
require => [
|
require => [
|
||||||
Package['tox'],
|
|
||||||
Package[$tempest::params::dev_packages],
|
Package[$tempest::params::dev_packages],
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,6 @@ class tempest::params {
|
|||||||
$python_barbican_tests = 'python3-barbican-tests-tempest'
|
$python_barbican_tests = 'python3-barbican-tests-tempest'
|
||||||
$python_manila_tests = 'python3-manila-tests-tempest'
|
$python_manila_tests = 'python3-manila-tests-tempest'
|
||||||
$package_name = 'openstack-tempest'
|
$package_name = 'openstack-tempest'
|
||||||
$pip_package_name = $facts['os']['name'] ? {
|
|
||||||
'RedHat' => undef,
|
|
||||||
default => 'python3-pip'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$dev_packages = [
|
$dev_packages = [
|
||||||
@ -46,8 +42,7 @@ class tempest::params {
|
|||||||
'libssl-dev',
|
'libssl-dev',
|
||||||
'libffi-dev',
|
'libffi-dev',
|
||||||
'patch',
|
'patch',
|
||||||
'gcc',
|
'gcc'
|
||||||
'python3-virtualenv',
|
|
||||||
]
|
]
|
||||||
$python_telemetry_tests = 'telemetry-tempest-plugin'
|
$python_telemetry_tests = 'telemetry-tempest-plugin'
|
||||||
$python_cinder_tests = 'cinder-tempest-plugin'
|
$python_cinder_tests = 'cinder-tempest-plugin'
|
||||||
@ -68,7 +63,6 @@ class tempest::params {
|
|||||||
$python_barbican_tests = 'barbican-tempest-plugin'
|
$python_barbican_tests = 'barbican-tempest-plugin'
|
||||||
$python_manila_tests = 'manila-tempest-plugin'
|
$python_manila_tests = 'manila-tempest-plugin'
|
||||||
$package_name = 'tempest'
|
$package_name = 'tempest'
|
||||||
$pip_package_name = 'python3-pip'
|
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail("Unsupported osfamily: ${facts['os']['family']}")
|
fail("Unsupported osfamily: ${facts['os']['family']}")
|
||||||
|
@ -176,17 +176,6 @@ describe 'tempest' do
|
|||||||
|
|
||||||
is_expected.to contain_class('tempest::params')
|
is_expected.to contain_class('tempest::params')
|
||||||
|
|
||||||
if platform_params[:pip_package_name]
|
|
||||||
is_expected.to contain_package('pip').with(
|
|
||||||
:name => platform_params[:pip_package_name],
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
is_expected.to contain_package('tox').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:provider => 'pip',
|
|
||||||
)
|
|
||||||
|
|
||||||
is_expected.to contain_vcsrepo('/var/lib/tempest').with(
|
is_expected.to contain_vcsrepo('/var/lib/tempest').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:source => 'https://opendev.org/openstack/tempest',
|
:source => 'https://opendev.org/openstack/tempest',
|
||||||
@ -400,7 +389,7 @@ describe 'tempest' do
|
|||||||
|
|
||||||
it 'sets up virtualenv for tempest' do
|
it 'sets up virtualenv for tempest' do
|
||||||
is_expected.to contain_exec('create-venv').with(
|
is_expected.to contain_exec('create-venv').with(
|
||||||
:command => ['virtualenv', '-p', 'python3', '/var/lib/tempest/.venv'],
|
:command => ['python3', '-m', 'venv', '/var/lib/tempest/.venv'],
|
||||||
:creates => '/var/lib/tempest/.venv',
|
:creates => '/var/lib/tempest/.venv',
|
||||||
:path => ['/bin', '/usr/bin', '/usr/local/bin']
|
:path => ['/bin', '/usr/bin', '/usr/local/bin']
|
||||||
)
|
)
|
||||||
@ -409,7 +398,7 @@ describe 'tempest' do
|
|||||||
it 'installs tempest into the virtualenv' do
|
it 'installs tempest into the virtualenv' do
|
||||||
is_expected.to contain_exec('install-tempest').with(
|
is_expected.to contain_exec('install-tempest').with(
|
||||||
:command => [
|
:command => [
|
||||||
'virtualenv', '-p', 'python3', '/var/lib/tempest/.venv'
|
'pytho3', '-m' 'venv', '/var/lib/tempest/.venv'
|
||||||
],
|
],
|
||||||
:command => [
|
:command => [
|
||||||
"/var/lib/tempest/.venv/bin/#{platform_params[:pip_command]}", 'install',
|
"/var/lib/tempest/.venv/bin/#{platform_params[:pip_command]}", 'install',
|
||||||
@ -583,11 +572,9 @@ describe 'tempest' do
|
|||||||
'libssl-dev',
|
'libssl-dev',
|
||||||
'libffi-dev',
|
'libffi-dev',
|
||||||
'patch',
|
'patch',
|
||||||
'gcc',
|
'gcc'],
|
||||||
'python3-virtualenv'],
|
|
||||||
:package_name => 'tempest',
|
:package_name => 'tempest',
|
||||||
:pip_command => 'pip3',
|
:pip_command => 'pip3',
|
||||||
:pip_package_name => 'python3-pip',
|
|
||||||
:python_heat_tests => 'heat-tempest-plugin',
|
:python_heat_tests => 'heat-tempest-plugin',
|
||||||
:python_keystone_tests => 'keystone-tempest-plugin',
|
:python_keystone_tests => 'keystone-tempest-plugin',
|
||||||
:python_neutron_tests => 'neutron-tempest-plugin',
|
:python_neutron_tests => 'neutron-tempest-plugin',
|
||||||
@ -602,7 +589,6 @@ describe 'tempest' do
|
|||||||
'gcc'],
|
'gcc'],
|
||||||
:package_name => 'openstack-tempest',
|
:package_name => 'openstack-tempest',
|
||||||
:pip_command => 'pip3',
|
:pip_command => 'pip3',
|
||||||
:pip_package_name => 'python3-pip',
|
|
||||||
:python_heat_tests => 'python3-heat-tests-tempest',
|
:python_heat_tests => 'python3-heat-tests-tempest',
|
||||||
:python_keystone_tests => 'python3-keystone-tests-tempest',
|
:python_keystone_tests => 'python3-keystone-tests-tempest',
|
||||||
:python_neutron_tests => 'python3-neutron-tests-tempest',
|
:python_neutron_tests => 'python3-neutron-tests-tempest',
|
||||||
|
Loading…
Reference in New Issue
Block a user