Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: optional uv #807

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

IS_PYPY = sys.implementation.name == 'pypy'
IS_WINDOWS = sys.platform.startswith('win')
MISSING_UV = not shutil.which('uv')


@pytest.mark.isolated
Expand Down Expand Up @@ -206,6 +207,7 @@ def test_default_impl_install_cmd_well_formed(

@pytest.mark.parametrize('verbosity', range(4))
@pytest.mark.skipif(IS_PYPY, reason='uv cannot find PyPy executable')
@pytest.mark.skipif(MISSING_UV, reason='uv executable not found')
def test_uv_impl_install_cmd_well_formed(
mocker: pytest_mock.MockerFixture,
verbosity: int,
Expand Down Expand Up @@ -237,7 +239,12 @@ def test_uv_impl_install_cmd_well_formed(
('pip', 'venv+pip', False),
('pip', 'virtualenv+pip', True),
('pip', 'virtualenv+pip', None), # Fall-through
('uv', 'venv+uv', None),
pytest.param(
'uv',
'venv+uv',
None,
marks=pytest.mark.skipif(MISSING_UV, reason='uv executable not found'),
),
],
indirect=('has_virtualenv',),
)
Expand All @@ -257,9 +264,13 @@ def test_venv_creation(
'pip',
pytest.param(
'uv',
marks=pytest.mark.xfail(
IS_PYPY and IS_WINDOWS and sys.version_info < (3, 9), reason='uv cannot find PyPy 3.8 executable on Windows'
),
marks=[
pytest.mark.xfail(
IS_PYPY and IS_WINDOWS and sys.version_info < (3, 9),
reason='uv cannot find PyPy 3.8 executable on Windows',
),
pytest.mark.skipif(MISSING_UV, reason='uv executable not found'),
],
),
],
)
Expand All @@ -271,6 +282,7 @@ def test_requirement_installation(
env.install([f'test-flit @ {Path(package_test_flit).as_uri()}'])


@pytest.mark.skipif(MISSING_UV, reason='uv executable not found')
def test_external_uv_detection_success(
caplog: pytest.LogCaptureFixture,
mocker: pytest_mock.MockerFixture,
Expand Down
10 changes: 9 additions & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

IS_WINDOWS = sys.platform.startswith('win')
IS_PYPY = sys.implementation.name == 'pypy'
MISSING_UV = not shutil.which('uv')


INTEGRATION_SOURCES = {
Expand Down Expand Up @@ -79,7 +80,14 @@ def _ignore_folder(base, filenames):
)
@pytest.mark.parametrize(
'args',
[[], ['--installer', 'uv'], ['-x', '--no-isolation']],
[
[],
pytest.param(
['--installer', 'uv'],
marks=pytest.mark.skipif(MISSING_UV, reason='uv executable not found'),
),
['-x', '--no-isolation'],
],
ids=['isolated_pip', 'isolated_uv', 'no_isolation'],
)
@pytest.mark.parametrize(
Expand Down
Loading