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:
Zamil Majdy
2026-03-14 06:44:23 +07:00
parent 1e03a56f28
commit 81c51f91f3
2 changed files with 15 additions and 4 deletions

View File

@@ -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

View File

@@ -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"},