Skip to content

Commit b03ad20

Browse files
committed
Ubuntu 16.04: Execute tests on Python 3
Since Python 2 is EOL, we should execute all tests on Python 3.
1 parent 7fc3a77 commit b03ad20

File tree

2 files changed

+46
-22
lines changed

2 files changed

+46
-22
lines changed

spec/acceptance/facts_test_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ class { 'python' :
1111
EOS
1212

1313
fact_notices = <<-EOS
14-
notify{"pip_version: ${::pip_version}":}
15-
notify{"system_python_version: ${::system_python_version}":}
16-
notify{"python_version: ${::python_version}":}
17-
notify{"virtualenv_version: ${::virtualenv_version}":}
14+
notify{"pip_version: ${facts['pip_version']}":}
15+
notify{"system_python_version: ${facts['system_python_version']}":}
16+
notify{"python_version: ${facts['python_version']}":}
17+
notify{"virtualenv_version: ${facts['virtualenv_version']}":}
1818
EOS
1919

2020
# rubocop:disable RSpec/RepeatedExample

spec/acceptance/virtualenv_spec.rb

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
# Using puppet_apply as a helper
66
it 'works with no errors' do
77
pp = <<-EOS
8+
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
9+
$version = '3'
10+
} else {
11+
$version = 'system'
12+
}
813
class { 'python' :
9-
version => 'system',
14+
version => $version,
1015
pip => 'present',
1116
virtualenv => 'present',
1217
}
1318
-> python::virtualenv { 'venv' :
1419
ensure => 'present',
20+
version => $version,
1521
systempkgs => false,
1622
venv_dir => '/opt/venv',
17-
owner => 'root',
18-
group => 'root',
1923
}
2024
-> python::pip { 'rpyc' :
2125
ensure => '3.2.3',
@@ -30,17 +34,21 @@ class { 'python' :
3034

3135
it 'maintains pip version' do
3236
pp = <<-EOS
37+
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
38+
$version = '3'
39+
} else {
40+
$version = 'system'
41+
}
3342
class { 'python' :
34-
version => 'system',
43+
version => $version,
3544
pip => 'present',
3645
virtualenv => 'present',
3746
}
3847
-> python::virtualenv { 'venv' :
3948
ensure => 'present',
49+
version => $version,
4050
systempkgs => false,
4151
venv_dir => '/opt/venv2',
42-
owner => 'root',
43-
group => 'root',
4452
}
4553
-> python::pip { 'pip' :
4654
ensure => '18.0',
@@ -55,17 +63,21 @@ class { 'python' :
5563

5664
it 'works with ensure=>latest' do
5765
pp = <<-EOS
66+
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
67+
$version = '3'
68+
} else {
69+
$version = 'system'
70+
}
5871
class { 'python' :
59-
version => 'system',
72+
version => $version,
6073
pip => 'present',
6174
virtualenv => 'present',
6275
}
6376
-> python::virtualenv { 'venv' :
6477
ensure => 'present',
78+
version => $version,
6579
systempkgs => false,
6680
venv_dir => '/opt/venv3',
67-
owner => 'root',
68-
group => 'root',
6981
}
7082
-> python::pip { 'rpyc' :
7183
ensure => 'latest',
@@ -82,17 +94,21 @@ class { 'python' :
8294

8395
it 'works with ensure=>latest for package with underscore in its name' do
8496
pp = <<-EOS
97+
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
98+
$version = '3'
99+
} else {
100+
$version = 'system'
101+
}
85102
class { 'python' :
86-
version => 'system',
103+
version => $version,
87104
pip => 'present',
88105
virtualenv => 'present',
89106
}
90107
-> python::virtualenv { 'venv' :
91108
ensure => 'present',
109+
version => $version,
92110
systempkgs => false,
93111
venv_dir => '/opt/venv4',
94-
owner => 'root',
95-
group => 'root',
96112
}
97113
-> python::pip { 'int_date' :
98114
ensure => 'latest',
@@ -109,20 +125,24 @@ class { 'python' :
109125

110126
it 'works with editable=>true' do
111127
pp = <<-EOS
128+
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
129+
$version = '3'
130+
} else {
131+
$version = 'system'
132+
}
112133
package{ 'git' :
113134
ensure => 'present',
114135
}
115136
-> class { 'python' :
116-
version => 'system',
137+
version => $version,
117138
pip => 'present',
118139
virtualenv => 'present',
119140
}
120141
-> python::virtualenv { 'venv' :
121142
ensure => 'present',
143+
version => $version,
122144
systempkgs => false,
123145
venv_dir => '/opt/venv5',
124-
owner => 'root',
125-
group => 'root',
126146
}
127147
-> python::pip { 'rpyc' :
128148
ensure => '4.1.0',
@@ -139,17 +159,21 @@ class { 'python' :
139159

140160
it 'works with == in pkgname' do
141161
pp = <<-EOS
162+
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
163+
$version = '3'
164+
} else {
165+
$version = 'system'
166+
}
142167
class { 'python' :
143-
version => 'system',
168+
version => $version,
144169
pip => 'present',
145170
virtualenv => 'present',
146171
}
147172
-> python::virtualenv { 'venv' :
148173
ensure => 'present',
174+
version => $version,
149175
systempkgs => false,
150176
venv_dir => '/opt/venv6',
151-
owner => 'root',
152-
group => 'root',
153177
}
154178
-> python::pip { 'rpyc==4.1.0' :
155179
virtualenv => '/opt/venv6',

0 commit comments

Comments
 (0)