tests.test_manager_uv module

uv-specific behaviors: the launched-by-uv cache guard and the PEP 668 guard.

A parent uv run (or uvx) process keeps a lock on the uv cache for as long as its child lives, so an mpm launched through it must not attempt uv cache clean: the command would wait on its own ancestor for``UV_LOCK_TIMEOUT`` and fail. uv marks its children with the UV environment variable.

Outside a virtual environment, uv pip reads a system Python. When that Python is externally managed, the uv manager reports as unavailable.

tests.test_manager_uv.uv_manager(monkeypatch)[source]

A new uv manager that meets every base condition of availability.

tests.test_manager_uv.test_unavailable_when_uv_pip_targets_externally_managed_python(uv_manager, probe_stdout, expected)[source]

The interpreter uv python find names runs the PEP 668 probe.

tests.test_manager_uv.test_failed_probe_keeps_uv_available(uv_manager, answers)[source]

A probe that cannot answer must not hide the manager.

tests.test_manager_uv.test_base_reason_wins_over_the_python_probe(monkeypatch)[source]

A host failing a base condition reports it, and runs no probe.

tests.test_manager_uv.test_uvx_runs_no_python_probe(monkeypatch)[source]

uv tool keeps each tool in its own virtual environment: no probe.

tests.test_manager_uv.capture_uv_run_cli(capture_run_cli)[source]

Record the uv manager’s run_cli invocations instead of executing.

tests.test_manager_uv.test_cleanup_cache_skipped_under_uv(monkeypatch, caplog, capture_uv_run_cli)[source]

Launched by uv run, the cache commands are skipped with a warning.

They would deadlock on the parent’s cache lock until UV_LOCK_TIMEOUT.

tests.test_manager_uv.test_cleanup_cache_runs_outside_uv(monkeypatch, capture_uv_run_cli)[source]

Outside a uv launcher, the cache clean and prune both run.