|
36 | 36 | manage_python_package: false, |
37 | 37 | manage_dev_package: false, |
38 | 38 | manage_pip_package: false, |
39 | | - manage_venv_package: false |
| 39 | + manage_venv_package: false, |
40 | 40 | } |
41 | 41 | end |
42 | 42 |
|
|
53 | 53 | manage_pip_package: true, |
54 | 54 | manage_venv_package: true, |
55 | 55 | pip: 'present', |
56 | | - venv: 'present' |
| 56 | + venv: 'present', |
57 | 57 | } |
58 | 58 | end |
59 | 59 |
|
|
112 | 112 | { |
113 | 113 | python_pyvenvs: { |
114 | 114 | '/opt/env1' => { |
115 | | - version: '3.8' |
| 115 | + version: '3.8', |
116 | 116 | }, |
117 | 117 | '/opt/env2' => { |
118 | | - version: '3.8' |
119 | | - } |
120 | | - } |
| 118 | + version: '3.8', |
| 119 | + }, |
| 120 | + }, |
121 | 121 | } |
122 | 122 | end |
123 | 123 |
|
|
139 | 139 | python_pyvenvs: { |
140 | 140 | '/opt/env1' => { |
141 | 141 | version: '3.8', |
142 | | - pip_version: 'latest' |
| 142 | + pip_version: 'latest', |
143 | 143 | }, |
144 | 144 | '/opt/env2' => { |
145 | 145 | version: '3.8', |
146 | | - pip_version: '<= 20.3.4' |
147 | | - } |
148 | | - } |
| 146 | + pip_version: '<= 20.3.4', |
| 147 | + }, |
| 148 | + }, |
149 | 149 | } |
150 | 150 | end |
151 | 151 |
|
|
155 | 155 | it { is_expected.to contain_python__pyvenv('/opt/env2').with_ensure('present') } |
156 | 156 |
|
157 | 157 | it { |
158 | | - expect(subject).to contain_exec('python_virtualenv_/opt/env1'). |
159 | | - with( |
| 158 | + expect(subject).to contain_exec('python_virtualenv_/opt/env1') |
| 159 | + .with( |
160 | 160 | command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip install --upgrade pip && /opt/env1/bin/pip install --upgrade setuptools', |
161 | 161 | user: 'root', |
162 | 162 | creates: '/opt/env1/bin/activate', |
163 | 163 | path: [ |
164 | 164 | '/bin', |
165 | 165 | '/usr/bin', |
166 | 166 | '/usr/sbin', |
167 | | - '/usr/local/bin' |
| 167 | + '/usr/local/bin', |
168 | 168 | ], |
169 | 169 | cwd: '/tmp', |
170 | 170 | environment: [], |
171 | 171 | timeout: 600, |
172 | | - unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env1\[\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$} |
173 | | - ). |
174 | | - that_requires('File[/opt/env1]') |
| 172 | + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env1\[\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$}, |
| 173 | + ) |
| 174 | + .that_requires('File[/opt/env1]') |
175 | 175 | } |
176 | 176 |
|
177 | 177 | it { |
178 | | - expect(subject).to contain_exec('python_virtualenv_/opt/env2'). |
179 | | - with( |
| 178 | + expect(subject).to contain_exec('python_virtualenv_/opt/env2') |
| 179 | + .with( |
180 | 180 | command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip install --upgrade setuptools', |
181 | 181 | user: 'root', |
182 | 182 | creates: '/opt/env2/bin/activate', |
183 | 183 | path: [ |
184 | 184 | '/bin', |
185 | 185 | '/usr/bin', |
186 | 186 | '/usr/sbin', |
187 | | - '/usr/local/bin' |
| 187 | + '/usr/local/bin', |
188 | 188 | ], |
189 | 189 | cwd: '/tmp', |
190 | 190 | environment: [], |
191 | 191 | timeout: 600, |
192 | | - unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env2\[\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$} |
193 | | - ). |
194 | | - that_requires('File[/opt/env2]') |
| 192 | + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env2\[\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$}, |
| 193 | + ) |
| 194 | + .that_requires('File[/opt/env2]') |
195 | 195 | } |
196 | 196 |
|
197 | 197 | it { is_expected.to contain_file('/opt/env1') } |
|
384 | 384 |
|
385 | 385 | it { |
386 | 386 | expect(subject).to contain_package('pip').with( |
387 | | - 'provider' => 'pip' |
| 387 | + 'provider' => 'pip', |
388 | 388 | ) |
389 | 389 | } |
390 | 390 | end |
|
0 commit comments