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
)
@@ -257,9 +264,13 @@ def test_venv_creation(
257
264
'pip' ,
258
265
pytest .param (
259
266
'uv' ,
260
- marks = pytest .mark .xfail (
261
- IS_PYPY and IS_WINDOWS and sys .version_info < (3 , 9 ), reason = 'uv cannot find PyPy 3.8 executable on Windows'
262
- ),
267
+ marks = [
268
+ pytest .mark .xfail (
269
+ IS_PYPY and IS_WINDOWS and sys .version_info < (3 , 9 ),
270
+ reason = 'uv cannot find PyPy 3.8 executable on Windows' ,
271
+ ),
272
+ pytest .mark .skipif (MISSING_UV , reason = 'uv executable not found' ),
273
+ ],
263
274
),
264
275
],
265
276
)
@@ -271,6 +282,7 @@ def test_requirement_installation(
271
282
env .install ([f'test-flit @ { Path (package_test_flit ).as_uri ()} ' ])
272
283
273
284
285
+ @pytest .mark .skipif (MISSING_UV , reason = 'uv executable not found' )
274
286
def test_external_uv_detection_success (
275
287
caplog : pytest .LogCaptureFixture ,
276
288
mocker : pytest_mock .MockerFixture ,
0 commit comments