2121
2222IS_PYPY = sys .implementation .name == 'pypy'
2323IS_WINDOWS = sys .platform .startswith ('win' )
24+ MISSING_UV = not shutil .which ('uv' )
2425
2526
2627@pytest .mark .isolated
@@ -206,6 +207,7 @@ def test_default_impl_install_cmd_well_formed(
206207
207208@pytest .mark .parametrize ('verbosity' , range (4 ))
208209@pytest .mark .skipif (IS_PYPY , reason = 'uv cannot find PyPy executable' )
210+ @pytest .mark .skipif (MISSING_UV , reason = 'uv executable not found' )
209211def test_uv_impl_install_cmd_well_formed (
210212 mocker : pytest_mock .MockerFixture ,
211213 verbosity : int ,
@@ -237,7 +239,12 @@ def test_uv_impl_install_cmd_well_formed(
237239 ('pip' , 'venv+pip' , False ),
238240 ('pip' , 'virtualenv+pip' , True ),
239241 ('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+ ),
241248 ],
242249 indirect = ('has_virtualenv' ,),
243250)
@@ -257,9 +264,13 @@ def test_venv_creation(
257264 'pip' ,
258265 pytest .param (
259266 '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+ ],
263274 ),
264275 ],
265276)
@@ -271,6 +282,7 @@ def test_requirement_installation(
271282 env .install ([f'test-flit @ { Path (package_test_flit ).as_uri ()} ' ])
272283
273284
285+ @pytest .mark .skipif (MISSING_UV , reason = 'uv executable not found' )
274286def test_external_uv_detection_success (
275287 caplog : pytest .LogCaptureFixture ,
276288 mocker : pytest_mock .MockerFixture ,
0 commit comments