Skip to content

Commit

Permalink
Ubuntu 16.04: Execute tests on Python 3
Browse files Browse the repository at this point in the history
Since Python 2 is EOL, we should execute all tests on Python 3.
  • Loading branch information
bastelfreak committed Apr 26, 2020
1 parent 7fc3a77 commit b03ad20
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 22 deletions.
8 changes: 4 additions & 4 deletions spec/acceptance/facts_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class { 'python' :
EOS

fact_notices = <<-EOS
notify{"pip_version: ${::pip_version}":}
notify{"system_python_version: ${::system_python_version}":}
notify{"python_version: ${::python_version}":}
notify{"virtualenv_version: ${::virtualenv_version}":}
notify{"pip_version: ${facts['pip_version']}":}
notify{"system_python_version: ${facts['system_python_version']}":}
notify{"python_version: ${facts['python_version']}":}
notify{"virtualenv_version: ${facts['virtualenv_version']}":}
EOS

# rubocop:disable RSpec/RepeatedExample
Expand Down
60 changes: 42 additions & 18 deletions spec/acceptance/virtualenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@
# Using puppet_apply as a helper
it 'works with no errors' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
class { 'python' :
version => 'system',
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv',
owner => 'root',
group => 'root',
}
-> python::pip { 'rpyc' :
ensure => '3.2.3',
Expand All @@ -30,17 +34,21 @@ class { 'python' :

it 'maintains pip version' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
class { 'python' :
version => 'system',
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv2',
owner => 'root',
group => 'root',
}
-> python::pip { 'pip' :
ensure => '18.0',
Expand All @@ -55,17 +63,21 @@ class { 'python' :

it 'works with ensure=>latest' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
class { 'python' :
version => 'system',
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv3',
owner => 'root',
group => 'root',
}
-> python::pip { 'rpyc' :
ensure => 'latest',
Expand All @@ -82,17 +94,21 @@ class { 'python' :

it 'works with ensure=>latest for package with underscore in its name' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
class { 'python' :
version => 'system',
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv4',
owner => 'root',
group => 'root',
}
-> python::pip { 'int_date' :
ensure => 'latest',
Expand All @@ -109,20 +125,24 @@ class { 'python' :

it 'works with editable=>true' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
package{ 'git' :
ensure => 'present',
}
-> class { 'python' :
version => 'system',
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv5',
owner => 'root',
group => 'root',
}
-> python::pip { 'rpyc' :
ensure => '4.1.0',
Expand All @@ -139,17 +159,21 @@ class { 'python' :

it 'works with == in pkgname' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
class { 'python' :
version => 'system',
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv6',
owner => 'root',
group => 'root',
}
-> python::pip { 'rpyc==4.1.0' :
virtualenv => '/opt/venv6',
Expand Down

0 comments on commit b03ad20

Please sign in to comment.