Skip to content

Commit 56d4787

Browse files
committed
hatch: tests: Update uv command search
1 parent 7228620 commit 56d4787

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tests/conftest.py

+3-1
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

+3-1
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)