Skip to content

Commit 114deef

Browse files
wuliang229copybara-github
authored andcommitted
test: prevent test_resource_limits_set from hanging in GitHub Actions
Set mock_process.pid to None in the resource limits test. Without this, the `finally` block in `run_async` attempts to call `os.killpg` with a fallback `Mock` object (which evaluates to True). In some environments like GitHub Actions, this can inadvertently kill the test runner's process group rather than raising a TypeException, causing the CI job to hang indefinitely. Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 895992429
1 parent 9199189 commit 114deef

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/unittests/tools/test_bash_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ async def test_resource_limits_set(self, workspace, tool_context_confirmed):
252252
)
253253
tool = bash_tool.ExecuteBashTool(workspace=workspace, policy=policy)
254254
mock_process = mock.AsyncMock()
255+
mock_process.pid = None # Ensure finally block doesn't try to kill it
255256
mock_process.communicate.return_value = (b"", b"")
256257
mock_exec = mock.AsyncMock(return_value=mock_process)
257258

0 commit comments

Comments
 (0)