File tree Expand file tree Collapse file tree
tests/usethis/_integrations/backend/uv Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import pytest
55
66from usethis ._config import usethis_config
7+ from usethis ._integrations .backend .uv .errors import UVSubprocessFailedError
78from usethis ._integrations .backend .uv .version import FALLBACK_UV_VERSION , get_uv_version
89from usethis ._integrations .ci .github .errors import GitHubTagError
910from usethis ._integrations .ci .github .tags import get_github_latest_tag
@@ -40,3 +41,19 @@ def test_matches_pattern(self, tmp_path: Path):
4041 assert major .isdigit ()
4142 assert minor .isdigit ()
4243 assert patch .isdigit ()
44+
45+ def test_mock_subprocess_failure (self , monkeypatch : pytest .MonkeyPatch ):
46+ # Arrange
47+ def mock_call_uv_subprocess (* _ , ** __ ) -> str :
48+ raise UVSubprocessFailedError
49+
50+ monkeypatch .setattr (
51+ "usethis._integrations.backend.uv.version.call_uv_subprocess" ,
52+ mock_call_uv_subprocess ,
53+ )
54+
55+ # Act
56+ version = get_uv_version ()
57+
58+ # Assert
59+ assert version == FALLBACK_UV_VERSION
You can’t perform that action at this time.
0 commit comments