From 884485e7e6edec1a3633bef0a2ce2abd8cedfa09 Mon Sep 17 00:00:00 2001 From: ZiyaZhang <199893125+ZiyaZhang@users.noreply.github.com> Date: Thu, 10 Sep 2026 05:40:50 -0700 Subject: [PATCH] test(python): restore concat through its spy --- .../code-runtime-python/tests/runtime.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/experimental/code-runtime-python/tests/runtime.spec.ts b/packages/experimental/code-runtime-python/tests/runtime.spec.ts index 826524adc5..6c028cdeb5 100644 --- a/packages/experimental/code-runtime-python/tests/runtime.spec.ts +++ b/packages/experimental/code-runtime-python/tests/runtime.spec.ts @@ -4784,15 +4784,15 @@ describe('PythonCodeRuntime — hostile peer', () => { // One-byte data events force the fragment-count limit independently of pipe // coalescing. The input-list bound rejects missing seals; copied bytes reject // repeatedly merging the sealed prefix. Both regressions preserve log text. - const realConcat = Buffer.concat + const realConcat = Buffer.concat.bind(Buffer) const previousSplitStdout = splitStdout.value let copied = 0 let maxParts = 0 - Buffer.concat = (list: readonly Uint8Array[], total?: number): Buffer => { + const concatSpy = vi.spyOn(Buffer, 'concat').mockImplementation((list: readonly Uint8Array[], total?: number): Buffer => { for (const part of list) copied += part.length maxParts = Math.max(maxParts, list.length) return realConcat(list, total) - } + }) let result: CodeRunResult try { splitStdout.value = true @@ -4806,7 +4806,7 @@ describe('PythonCodeRuntime — hostile peer', () => { bindings: [], }) } finally { - Buffer.concat = realConcat + concatSpy.mockRestore() splitStdout.value = previousSplitStdout } expect(result.error).toBeUndefined()