Blame SOURCES/0002-tests-optional-uv.patch

541142
From aeacd07739c21d0a71553225b827a94065494ffe Mon Sep 17 00:00:00 2001
541142
From: Carl George <carlwgeorge@gmail.com>
541142
Date: Thu, 29 Aug 2024 21:49:56 -0500
541142
Subject: [PATCH 2/3] tests: optional uv
541142
541142
Skip the tests that need uv when uv is not installed.  This makes it
541142
easier for Linux distros that package build to avoid a build-time
541142
dependency on uv.
541142
541142
(cherry picked from commit ab9acba8dfe009a4ce69ecf4df9fbb1ec8d044c8)
541142
---
541142
 tests/test_env.py         | 18 ++++++++++++++++--
541142
 tests/test_integration.py | 10 +++++++++-
541142
 2 files changed, 25 insertions(+), 3 deletions(-)
541142
541142
diff --git a/tests/test_env.py b/tests/test_env.py
541142
index 035457f..1f8f489 100644
541142
--- a/tests/test_env.py
541142
+++ b/tests/test_env.py
541142
@@ -21,6 +21,7 @@ import build.env
541142
 
541142
 IS_PYPY = sys.implementation.name == 'pypy'
541142
 IS_WINDOWS = sys.platform.startswith('win')
541142
+MISSING_UV = not shutil.which('uv')
541142
 
541142
 
541142
 @pytest.mark.isolated
541142
@@ -206,6 +207,7 @@ def test_default_impl_install_cmd_well_formed(
541142
 
541142
 @pytest.mark.parametrize('verbosity', range(4))
541142
 @pytest.mark.skipif(IS_PYPY, reason='uv cannot find PyPy executable')
541142
+@pytest.mark.skipif(MISSING_UV, reason='uv executable not found')
541142
 def test_uv_impl_install_cmd_well_formed(
541142
     mocker: pytest_mock.MockerFixture,
541142
     verbosity: int,
541142
@@ -237,7 +239,12 @@ def test_uv_impl_install_cmd_well_formed(
541142
         ('pip', 'venv+pip', False),
541142
         ('pip', 'virtualenv+pip', True),
541142
         ('pip', 'virtualenv+pip', None),  # Fall-through
541142
-        ('uv', 'venv+uv', None),
541142
+        pytest.param(
541142
+            'uv',
541142
+            'venv+uv',
541142
+            None,
541142
+            marks=pytest.mark.skipif(MISSING_UV, reason='uv executable not found'),
541142
+        ),
541142
     ],
541142
     indirect=('has_virtualenv',),
541142
 )
541142
@@ -255,7 +262,13 @@ def test_venv_creation(
541142
     'installer',
541142
     [
541142
         'pip',
541142
-        pytest.param('uv', marks=pytest.mark.xfail(IS_PYPY and IS_WINDOWS, reason='uv cannot find PyPy executable')),
541142
+        pytest.param(
541142
+            'uv',
541142
+            marks=[
541142
+                pytest.mark.xfail(IS_PYPY and IS_WINDOWS, reason='uv cannot find PyPy executable'),
541142
+                pytest.mark.skipif(MISSING_UV, reason='uv executable not found'),
541142
+            ]
541142
+        ),
541142
     ],
541142
 )
541142
 def test_requirement_installation(
541142
@@ -266,6 +279,7 @@ def test_requirement_installation(
541142
         env.install([f'test-flit @ {Path(package_test_flit).as_uri()}'])
541142
 
541142
 
541142
+@pytest.mark.skipif(MISSING_UV, reason='uv executable not found')
541142
 def test_external_uv_detection_success(
541142
     caplog: pytest.LogCaptureFixture,
541142
     mocker: pytest_mock.MockerFixture,
541142
diff --git a/tests/test_integration.py b/tests/test_integration.py
541142
index 341c1d4..8e070a5 100644
541142
--- a/tests/test_integration.py
541142
+++ b/tests/test_integration.py
541142
@@ -18,6 +18,7 @@ import build.__main__
541142
 
541142
 IS_WINDOWS = sys.platform.startswith('win')
541142
 IS_PYPY = sys.implementation.name == 'pypy'
541142
+MISSING_UV = not shutil.which('uv')
541142
 
541142
 
541142
 INTEGRATION_SOURCES = {
541142
@@ -78,7 +79,14 @@ def get_project(name, tmp_path):
541142
 )
541142
 @pytest.mark.parametrize(
541142
     'args',
541142
-    [[], ['--installer', 'uv'], ['-x', '--no-isolation']],
541142
+    [
541142
+        [],
541142
+        pytest.param(
541142
+            ['--installer', 'uv'],
541142
+            marks=pytest.mark.skipif(MISSING_UV, reason='uv executable not found'),
541142
+        ),
541142
+        ['-x', '--no-isolation']
541142
+    ],
541142
     ids=['isolated_pip', 'isolated_uv', 'no_isolation'],
541142
 )
541142
 @pytest.mark.parametrize(
541142
-- 
541142
2.46.0
541142