Skip to content

Commit 306dd82

Browse files
committed
hatch: tests: Update uv command search
1 parent b1838f8 commit 306dd82

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/hatch/cli/application.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from hatch.utils.platform import Platform
1313
from hatch.utils.runner import ExecutionContext
1414

15+
from uv import find_uv_bin
16+
1517
if TYPE_CHECKING:
1618
from collections.abc import Generator
1719

@@ -160,7 +162,8 @@ def ensure_plugin_dependencies(self, dependencies: list[Requirement], *, wait_me
160162
if dependencies_in_sync(dependencies):
161163
return
162164

163-
pip_command = [sys.executable, '-u', '-m', 'uv', 'pip']
165+
uv_bin = find_uv_bin()
166+
pip_command = [uv_bin, 'pip']
164167

165168
pip_command.extend(['install'])
166169

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from click.testing import CliRunner as __CliRunner
1515
from filelock import FileLock
1616
from platformdirs import user_cache_dir, user_data_dir
17+
from uv import find_uv_bin
1718

1819
from hatch.config.constants import AppEnvVars, ConfigEnvVars, PublishEnvVars
1920
from hatch.config.user import ConfigFile
@@ -440,7 +441,8 @@ def _mock(command, **kwargs):
440441
mocked_subprocess_run(command, **kwargs)
441442
return mocked_subprocess_run
442443

443-
if command[:6] == [sys.executable, '-u', '-m', 'uv', 'pip', 'install']:
444+
uv_bin = find_uv_bin()
445+
if command[:3] == [uv_bin, 'pip', 'install']:
444446
mocked_subprocess_run(command, **kwargs)
445447
return mocked_subprocess_run
446448

tests/helpers/helpers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from unittest.mock import call
1313

1414
import tomli_w
15+
from uv import find_uv_bin
1516

1617
from hatch.config.user import RootConfig
1718
from hatch.env.utils import add_verbosity_flag
@@ -48,7 +49,8 @@ def get_current_timestamp():
4849

4950

5051
def assert_plugin_installation(subprocess_run, dependencies: list[str], *, verbosity=0, count=1):
51-
command = [sys.executable, '-u', '-m', 'uv', 'pip', 'install']
52+
uv_bin = find_uv_bin()
53+
command = [uv_bin, 'pip', 'install']
5254
add_verbosity_flag(command, verbosity, adjustment=-1)
5355
command.extend(dependencies)
5456

0 commit comments

Comments
 (0)