From 44ba42013051f6e3bf679ef6b8fa298c6c656bd7 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 17:53:05 +0000 Subject: [PATCH] fix: resolve lint issues in Windows CLI subprocess fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix RUF005: Use spread syntax instead of concatenation in install_crew.py - Fix S108: Replace /tmp with /home/test in test paths - Fix E501: Shorten function name to meet line length requirements These changes address the lint failures in CI while maintaining the core Windows subprocess compatibility fix. Co-Authored-By: João --- src/crewai/cli/install_crew.py | 2 +- tests/cli/test_subprocess_utils.py | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/crewai/cli/install_crew.py b/src/crewai/cli/install_crew.py index 649da342d..dc9bd81ab 100644 --- a/src/crewai/cli/install_crew.py +++ b/src/crewai/cli/install_crew.py @@ -14,7 +14,7 @@ def install_crew(proxy_options: list[str]) -> None: Install the crew by running the UV command to lock and install. """ try: - command = ["uv", "sync"] + proxy_options + command = ["uv", "sync", *proxy_options] run_command(command, check=True, capture_output=False, text=True) except subprocess.CalledProcessError as e: diff --git a/tests/cli/test_subprocess_utils.py b/tests/cli/test_subprocess_utils.py index 2ce123297..c9f6138a1 100644 --- a/tests/cli/test_subprocess_utils.py +++ b/tests/cli/test_subprocess_utils.py @@ -1,4 +1,3 @@ -import platform import subprocess from unittest import mock @@ -24,7 +23,7 @@ class TestRunCommand: mock_subprocess_run.assert_called_once() call_args = mock_subprocess_run.call_args - + assert call_args[1]["shell"] is True assert isinstance(call_args[0][0], str) assert "uv run test" in call_args[0][0] @@ -43,7 +42,7 @@ class TestRunCommand: mock_subprocess_run.assert_called_once() call_args = mock_subprocess_run.call_args - + assert call_args[1].get("shell", False) is False assert call_args[0][0] == command @@ -62,7 +61,7 @@ class TestRunCommand: mock_subprocess_run.assert_called_once() call_args = mock_subprocess_run.call_args command_str = call_args[0][0] - + assert '"hello world"' in command_str or "'hello world'" in command_str @mock.patch("platform.system") @@ -89,18 +88,18 @@ class TestRunCommand: capture_output=True, text=False, check=False, - cwd="/tmp", + cwd="/home/test", env={"TEST": "value"}, timeout=30 ) mock_subprocess_run.assert_called_once() call_args = mock_subprocess_run.call_args - + assert call_args[1]["capture_output"] is True assert call_args[1]["text"] is False assert call_args[1]["check"] is False - assert call_args[1]["cwd"] == "/tmp" + assert call_args[1]["cwd"] == "/home/test" assert call_args[1]["env"] == {"TEST": "value"} assert call_args[1]["timeout"] == 30 @@ -118,13 +117,13 @@ class TestRunCommand: mock_subprocess_run.assert_called_once() call_args = mock_subprocess_run.call_args - + assert call_args[1].get("shell", False) is False assert call_args[0][0] == command @mock.patch("platform.system") @mock.patch("subprocess.run") - def test_windows_string_command_passthrough(self, mock_subprocess_run, mock_platform): + def test_windows_string_passthrough(self, mock_subprocess_run, mock_platform): """Test that Windows passes through string commands unchanged.""" mock_platform.return_value = "Windows" mock_subprocess_run.return_value = subprocess.CompletedProcess( @@ -136,6 +135,6 @@ class TestRunCommand: mock_subprocess_run.assert_called_once() call_args = mock_subprocess_run.call_args - + assert call_args[0][0] == command_str assert call_args[1]["shell"] is True