Skip to content

Commit b67f324

Browse files
Ensure uv pip freeze is colorless (#37)
Co-authored-by: Bernát Gábor <[email protected]>
1 parent dba020f commit b67f324

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/tox_uv/_installer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _register_config(self) -> None:
2929
super()._register_config()
3030
if self._with_list_deps: # pragma: no branch
3131
conf = cast(ConfigDynamicDefinition[Command], self._env.conf._defined["list_dependencies_command"]) # noqa: SLF001
32-
conf.default = Command([self.uv, "pip", "freeze"])
32+
conf.default = Command([self.uv, "--color", "never", "pip", "freeze"])
3333

3434
@property
3535
def uv(self) -> str:

tests/test_tox_uv_api.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from __future__ import annotations
2+
3+
from typing import TYPE_CHECKING
4+
5+
if TYPE_CHECKING:
6+
from tox.execute import ExecuteRequest
7+
from tox.pytest import ToxProjectCreator
8+
9+
10+
def test_uv_list_dependencies_command(tox_project: ToxProjectCreator) -> None:
11+
project = tox_project({"tox.ini": "[testenv]\npackage=skip"})
12+
execute_calls = project.patch_execute(lambda r: 0 if "install" in r.run_id else None)
13+
result = project.run("--list-dependencies", "-vv")
14+
result.assert_success()
15+
request: ExecuteRequest = execute_calls.call_args[0][3]
16+
assert request.cmd[1:] == ["--color", "never", "pip", "freeze"]

0 commit comments

Comments
 (0)