Skip to content

Commit b983371

Browse files
yselkowitzlayday
authored andcommitted
tests: optional virtualenv
Skip the tests that need virtualenv when it is not installed. This makes it easier for Linux distros (e.g. RHEL) that package build to avoid a build-time dependency on virtualenv. Signed-off-by: Yaakov Selkowitz <[email protected]>
1 parent 6cd157a commit b983371

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/test_env.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
IS_WINDOWS = sys.platform.startswith('win')
2525

2626
MISSING_UV = importlib.util.find_spec('uv') is None and not shutil.which('uv')
27+
MISSING_VIRTUALENV = importlib.util.find_spec('virtualenv') is None
2728

2829

2930
@pytest.mark.isolated
@@ -243,8 +244,18 @@ def test_uv_impl_install_cmd_well_formed(
243244
('installer', 'env_backend_display_name', 'has_virtualenv'),
244245
[
245246
('pip', 'venv+pip', False),
246-
('pip', 'virtualenv+pip', True),
247-
('pip', 'virtualenv+pip', None), # Fall-through
247+
pytest.param(
248+
'pip',
249+
'virtualenv+pip',
250+
True,
251+
marks=pytest.mark.skipif(MISSING_VIRTUALENV, reason='virtualenv not found'),
252+
),
253+
pytest.param(
254+
'pip',
255+
'virtualenv+pip',
256+
None,
257+
marks=pytest.mark.skipif(MISSING_VIRTUALENV, reason='virtualenv not found'),
258+
), # Fall-through
248259
pytest.param(
249260
'uv',
250261
'venv+uv',

0 commit comments

Comments
 (0)