mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(backend): fix 2 CI test failures from media resolution changes
- test_multi_file_commit_error_path: provide execution_context kwarg now required by GithubMultiFileCommitBlock.run() - test_non_media_string_field_still_reads_content: mock _infer_format_from_workspace to avoid event loop binding issue in CI
This commit is contained in:
@@ -8,6 +8,7 @@ from backend.blocks.github.pull_requests import (
|
||||
GithubMergePullRequestBlock,
|
||||
prepare_pr_api_url,
|
||||
)
|
||||
from backend.data.execution import ExecutionContext
|
||||
from backend.util.exceptions import BlockExecutionError
|
||||
|
||||
# ── prepare_pr_api_url tests ──
|
||||
@@ -97,7 +98,11 @@ async def test_multi_file_commit_error_path():
|
||||
"credentials": TEST_CREDENTIALS_INPUT,
|
||||
}
|
||||
with pytest.raises(BlockExecutionError, match="ref update failed"):
|
||||
async for _ in block.execute(input_data, credentials=TEST_CREDENTIALS):
|
||||
async for _ in block.execute(
|
||||
input_data,
|
||||
credentials=TEST_CREDENTIALS,
|
||||
execution_context=ExecutionContext(),
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -1779,9 +1779,15 @@ async def test_non_media_string_field_still_reads_content():
|
||||
async def _resolve(ref, *a, **kw): # noqa: ARG001
|
||||
return "file content here"
|
||||
|
||||
with patch(
|
||||
"backend.copilot.sdk.file_ref.resolve_file_ref",
|
||||
new=AsyncMock(side_effect=_resolve),
|
||||
with (
|
||||
patch(
|
||||
"backend.copilot.sdk.file_ref.resolve_file_ref",
|
||||
new=AsyncMock(side_effect=_resolve),
|
||||
),
|
||||
patch(
|
||||
"backend.copilot.sdk.file_ref._infer_format_from_workspace",
|
||||
new=AsyncMock(return_value=None),
|
||||
),
|
||||
):
|
||||
result = await expand_file_refs_in_args(
|
||||
{"text": "@@agptfile:workspace://abc123"},
|
||||
|
||||
Reference in New Issue
Block a user