Skip to content

Commit 9371f1b

Browse files
GWealecopybara-github
authored andcommitted
fix(tests): skip bash tool tests on Windows
Merge #5680 ## Summary This fixes Windows test collection for `tests/unittests/tools/test_bash_tool.py`. The test module imports Python's `resource` module at import time, but `resource` is Unix-only and unavailable on Windows. As a result, running the targeted test on Windows fails during collection before pytest can report a skip. This change adds a module-level Windows skip before importing `resource`. ## Validation Ran on Windows 10 with Python 3.12: - `python -m pytest tests/unittests/tools/test_bash_tool.py -q` - `python -m pytest tests/unittests/platform -q` - `python -m pytest tests/unittests/utils/test_env_utils.py -q` Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 930811714
1 parent f4743cd commit 9371f1b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tests/unittests/tools/test_bash_tool.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,22 @@
1313
# limitations under the License.
1414

1515
import asyncio
16-
import resource
1716
import signal
17+
import sys
1818
from unittest import mock
1919

20+
import pytest
21+
22+
if sys.platform == "win32":
23+
pytest.skip(
24+
"bash tool tests require Unix resource module", allow_module_level=True
25+
)
26+
27+
import resource
28+
2029
from google.adk.tools import bash_tool
2130
from google.adk.tools import tool_context
2231
from google.adk.tools.tool_confirmation import ToolConfirmation
23-
import pytest
2432

2533

2634
@pytest.fixture

0 commit comments

Comments
 (0)