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 160160 # If it wasn't or if there is any error, the package manager will trigger a failure.
161161 $grep_regex = $_ensure ? {
162162 /^(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' )
165165 }
166166
167167 $extras_string = empty($extras ) ? {
195195 }
196196 } else {
197197 case $_ensure {
198- /^[0-9].*$/: {
198+ /^v? [0-9].*$/: {
199199 # Specific version
200200 $command = " ${pip_install} ${install_args} ${pip_common_args} ==${_ensure}"
201201 $unless_command = " ${pip_env} list | grep -i -e '${grep_regex} '"
Original file line number Diff line number Diff line change 147147 end
148148 end
149149
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+
150164 describe 'uninstall' do
151165 context 'adds correct title' do
152166 let ( :params ) { { ensure : 'absent' } }
You can’t perform that action at this time.
0 commit comments