From 83afc4a59926160a5daf16183a2f45add0d89eac Mon Sep 17 00:00:00 2001 From: Dmytro Bobrenko <17252809+dbobrenko@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:03:46 +0200 Subject: [PATCH] Add --clear flag to venv --- scripts/autoupdater.py | 4 ++-- tests/scripts/test_autoupdater.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/autoupdater.py b/scripts/autoupdater.py index b700db9d5..98e50101b 100644 --- a/scripts/autoupdater.py +++ b/scripts/autoupdater.py @@ -26,9 +26,9 @@ def read_python_version() -> str | None: def start_proc(config: Path) -> subprocess.Popen: py_ver = read_python_version() if py_ver: - subprocess.run(["uv", "venv", "--python", py_ver], check=True) + subprocess.run(["uv", "venv", "--python", py_ver, "--clear"], check=True) else: - subprocess.run(["uv", "venv"], check=True) + subprocess.run(["uv", "venv", "--clear"], check=True) # Install project in dev mode into the venv. subprocess.run(["uv", "pip", "install", ".[dev]"], check=True) diff --git a/tests/scripts/test_autoupdater.py b/tests/scripts/test_autoupdater.py index 84412aa7d..bc2b8ac71 100644 --- a/tests/scripts/test_autoupdater.py +++ b/tests/scripts/test_autoupdater.py @@ -37,7 +37,7 @@ def test_start_proc_with_version(mocker): autoupdater.read_python_version.assert_called_once() mock_run.assert_has_calls( [ - mock.call(["uv", "venv", "--python", "3.11.9"], check=True), + mock.call(["uv", "venv", "--python", "3.11.9", "--clear"], check=True), mock.call(["uv", "pip", "install", ".[dev]"], check=True), ] ) @@ -55,7 +55,7 @@ def test_start_proc_without_version(mocker): autoupdater.read_python_version.assert_called_once() mock_run.assert_has_calls( [ - mock.call(["uv", "venv"], check=True), + mock.call(["uv", "venv", "--clear"], check=True), mock.call(["uv", "pip", "install", ".[dev]"], check=True), ] )