Skip to content

Commit

Permalink
fix: Fix async mock in test_process_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Dec 24, 2024
1 parent 1f706fe commit 30f6166
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/unit/resolver/test_resolve_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ async def test_complete_runtime():
@pytest.mark.asyncio
async def test_process_issue(mock_output_dir, mock_prompt_template):
# Mock dependencies
mock_create_runtime = MagicMock()
mock_runtime = MagicMock(connect=AsyncMock())
mock_create_runtime = AsyncMock(return_value=mock_runtime)
mock_initialize_runtime = AsyncMock()
mock_run_controller = AsyncMock()
mock_complete_runtime = AsyncMock()
Expand Down Expand Up @@ -408,7 +409,9 @@ async def test_process_issue(mock_output_dir, mock_prompt_template):
handler_instance.reset_mock()

# Mock return values
mock_create_runtime.return_value = MagicMock(connect=AsyncMock())
mock_runtime = MagicMock(connect=AsyncMock())
mock_create_runtime.return_value = AsyncMock()
mock_create_runtime.return_value.__aenter__.return_value = mock_runtime
if test_case['run_controller_raises']:
mock_run_controller.side_effect = test_case['run_controller_raises']
else:
Expand Down

0 comments on commit 30f6166

Please sign in to comment.