File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 160
160
# If it wasn't or if there is any error, the package manager will trigger a failure.
161
161
$grep_regex = $_ensure ? {
162
162
/^(present |absent |latest)$/ => " ^${real_pkgname} [[:space:]].*$" ,
163
- /^[0-9].*$/ => " ^${real_pkgname} [[:space:]]\\ +(\\ ?${_ensure}\\ ()$\\ |$\\ |, \\ |[[:space:]]\\ )" ,
164
- default => fail(' ensure can be a version number or one of: present, absent, latest' )
163
+ /^v? [0-9].*$/ => " ^${real_pkgname} [[:space:]]\\ +(\\ ?${_ensure}\\ ()$\\ |$\\ |, \\ |[[:space:]]\\ )" ,
164
+ default => fail(' ensure can be a version number (e.g. 1.7.0 or v1.7.0) or one of: present, absent, latest' )
165
165
}
166
166
167
167
$extras_string = empty($extras ) ? {
195
195
}
196
196
} else {
197
197
case $_ensure {
198
- /^[0-9].*$/: {
198
+ /^v? [0-9].*$/: {
199
199
# Specific version
200
200
$command = " ${pip_install} ${install_args} ${pip_common_args} ==${_ensure}"
201
201
$unless_command = " ${pip_env} list | grep -i -e '${grep_regex} '"
Original file line number Diff line number Diff line change 147
147
end
148
148
end
149
149
150
+ describe 'install specific version' do
151
+ context 'supports v-prefixed version string' do
152
+ let ( :params ) { { ensure : 'v1.7.0' } }
153
+
154
+ it { is_expected . to contain_exec ( 'pip_install_rpyc' ) . with_command ( 'pip --log /tmp/pip.log install rpyc==v1.7.0' ) }
155
+ end
156
+
157
+ context 'supports version string without v-prefix' do
158
+ let ( :params ) { { ensure : '1.7.0' } }
159
+
160
+ it { is_expected . to contain_exec ( 'pip_install_rpyc' ) . with_command ( 'pip --log /tmp/pip.log install rpyc==1.7.0' ) }
161
+ end
162
+ end
163
+
150
164
describe 'uninstall' do
151
165
context 'adds correct title' do
152
166
let ( :params ) { { ensure : 'absent' } }
You can’t perform that action at this time.
0 commit comments