From b03ad20dffa0190b3cd8eac3db3d8b4b021a01ba Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 26 Apr 2020 14:57:24 +0200 Subject: [PATCH] Ubuntu 16.04: Execute tests on Python 3 Since Python 2 is EOL, we should execute all tests on Python 3. --- spec/acceptance/facts_test_spec.rb | 8 ++-- spec/acceptance/virtualenv_spec.rb | 60 +++++++++++++++++++++--------- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/spec/acceptance/facts_test_spec.rb b/spec/acceptance/facts_test_spec.rb index 26b7b72e..af136015 100644 --- a/spec/acceptance/facts_test_spec.rb +++ b/spec/acceptance/facts_test_spec.rb @@ -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 diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 82b81e2d..de60ab09 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -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', @@ -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', @@ -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', @@ -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', @@ -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', @@ -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',