Skip to content

Commit

Permalink
hatch: tests: Update uv command search
Browse files Browse the repository at this point in the history
  • Loading branch information
vpetrigo committed Jan 11, 2025
1 parent 7228620 commit 56d4787
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from click.testing import CliRunner as __CliRunner
from filelock import FileLock
from platformdirs import user_cache_dir, user_data_dir
from uv import find_uv_bin

from hatch.config.constants import AppEnvVars, ConfigEnvVars, PublishEnvVars
from hatch.config.user import ConfigFile
Expand Down Expand Up @@ -440,7 +441,8 @@ def _mock(command, **kwargs):
mocked_subprocess_run(command, **kwargs)
return mocked_subprocess_run

if command[:6] == [sys.executable, '-u', '-m', 'uv', 'pip', 'install']:
uv_bin = find_uv_bin()
if command[:3] == [uv_bin, 'pip', 'install']:
mocked_subprocess_run(command, **kwargs)
return mocked_subprocess_run

Expand Down
4 changes: 3 additions & 1 deletion tests/helpers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from unittest.mock import call

import tomli_w
from uv import find_uv_bin

from hatch.config.user import RootConfig
from hatch.env.utils import add_verbosity_flag
Expand Down Expand Up @@ -48,7 +49,8 @@ def get_current_timestamp():


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

Expand Down

0 comments on commit 56d4787

Please sign in to comment.