From 56d4787a2afa9614031dae49e722df1c06b87456 Mon Sep 17 00:00:00 2001 From: Vladimir Petrigo Date: Sat, 11 Jan 2025 15:47:08 +0100 Subject: [PATCH] hatch: tests: Update uv command search --- tests/conftest.py | 4 +++- tests/helpers/helpers.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index f3e8f0688..b217b70d9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 @@ -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 diff --git a/tests/helpers/helpers.py b/tests/helpers/helpers.py index 692487256..60ffd2ab0 100644 --- a/tests/helpers/helpers.py +++ b/tests/helpers/helpers.py @@ -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 @@ -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)