21
21
22
22
IS_PYPY = sys .implementation .name == 'pypy'
23
23
IS_WINDOWS = sys .platform .startswith ('win' )
24
+ MISSING_UV = not shutil .which ('uv' )
24
25
25
26
26
27
@pytest .mark .isolated
@@ -206,6 +207,7 @@ def test_default_impl_install_cmd_well_formed(
206
207
207
208
@pytest .mark .parametrize ('verbosity' , range (4 ))
208
209
@pytest .mark .skipif (IS_PYPY , reason = 'uv cannot find PyPy executable' )
210
+ @pytest .mark .skipif (MISSING_UV , reason = 'uv executable not found' )
209
211
def test_uv_impl_install_cmd_well_formed (
210
212
mocker : pytest_mock .MockerFixture ,
211
213
verbosity : int ,
@@ -237,7 +239,12 @@ def test_uv_impl_install_cmd_well_formed(
237
239
('pip' , 'venv+pip' , False ),
238
240
('pip' , 'virtualenv+pip' , True ),
239
241
('pip' , 'virtualenv+pip' , None ), # Fall-through
240
- ('uv' , 'venv+uv' , None ),
242
+ pytest .param (
243
+ 'uv' ,
244
+ 'venv+uv' ,
245
+ None ,
246
+ marks = pytest .mark .skipif (MISSING_UV , reason = 'uv executable not found' ),
247
+ ),
241
248
],
242
249
indirect = ('has_virtualenv' ,),
243
250
)
@@ -255,7 +262,13 @@ def test_venv_creation(
255
262
'installer' ,
256
263
[
257
264
'pip' ,
258
- pytest .param ('uv' , marks = pytest .mark .xfail (IS_PYPY and IS_WINDOWS , reason = 'uv cannot find PyPy executable' )),
265
+ pytest .param (
266
+ 'uv' ,
267
+ marks = [
268
+ pytest .mark .xfail (IS_PYPY and IS_WINDOWS , reason = 'uv cannot find PyPy executable' ),
269
+ pytest .mark .skipif (MISSING_UV , reason = 'uv executable not found' ),
270
+ ]
271
+ ),
259
272
],
260
273
)
261
274
def test_requirement_installation (
@@ -266,6 +279,7 @@ def test_requirement_installation(
266
279
env .install ([f'test-flit @ { Path (package_test_flit ).as_uri ()} ' ])
267
280
268
281
282
+ @pytest .mark .skipif (MISSING_UV , reason = 'uv executable not found' )
269
283
def test_external_uv_detection_success (
270
284
caplog : pytest .LogCaptureFixture ,
271
285
mocker : pytest_mock .MockerFixture ,
0 commit comments