From f6a48d593e483cb684d19cbd9fcd8d080ec12e6f Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Fri, 1 May 2026 19:17:55 -0700 Subject: [PATCH] test: standardise on `from a2a_mcp_server import ...` in TestStdioPipeAssertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit github-code-quality bot flagged 4 instances of `import a2a_mcp_server` in the new TestStdioPipeAssertion class — every other test in the file uses the `from a2a_mcp_server import ...` per-test pattern, so this is a real inconsistency. Switching the new tests to match. No behavior change; resolves the 4 unresolved review threads blocking the merge queue. Co-Authored-By: Claude Opus 4.7 (1M context) --- workspace/tests/test_a2a_mcp_server.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/workspace/tests/test_a2a_mcp_server.py b/workspace/tests/test_a2a_mcp_server.py index 175558fb..ac549d07 100644 --- a/workspace/tests/test_a2a_mcp_server.py +++ b/workspace/tests/test_a2a_mcp_server.py @@ -730,13 +730,13 @@ class TestStdioPipeAssertion: """Happy path — both fds are pipes (the production launch shape from any MCP client). Should return None without printing or exiting.""" - import a2a_mcp_server + from a2a_mcp_server import _assert_stdio_is_pipe_compatible r, w = os.pipe() try: # No exit, no stderr noise. We don't capture stderr here # because pipe path should produce zero output. - a2a_mcp_server._assert_stdio_is_pipe_compatible(stdin_fd=r, stdout_fd=w) + _assert_stdio_is_pipe_compatible(stdin_fd=r, stdout_fd=w) finally: os.close(r) os.close(w) @@ -749,7 +749,7 @@ class TestStdioPipeAssertion: `ValueError: Pipe transport is only for pipes...`. Post-fix we exit with code 2 and a stderr message that names the symptom + fix.""" - import a2a_mcp_server + from a2a_mcp_server import _assert_stdio_is_pipe_compatible # stdin = pipe (so we isolate the stdout failure path); # stdout = regular file (the bug condition). @@ -758,7 +758,7 @@ class TestStdioPipeAssertion: f = open(regular, "wb") try: with pytest.raises(SystemExit) as excinfo: - a2a_mcp_server._assert_stdio_is_pipe_compatible( + _assert_stdio_is_pipe_compatible( stdin_fd=r, stdout_fd=f.fileno() ) assert excinfo.value.code == 2 @@ -778,7 +778,7 @@ class TestStdioPipeAssertion: ): """Symmetric case — stdin redirected from a regular file. Same asyncio constraint applies via connect_read_pipe.""" - import a2a_mcp_server + from a2a_mcp_server import _assert_stdio_is_pipe_compatible regular = tmp_path / "input.json" regular.write_bytes(b'{"jsonrpc":"2.0","id":1,"method":"initialize"}\n') @@ -786,7 +786,7 @@ class TestStdioPipeAssertion: _r, w = os.pipe() try: with pytest.raises(SystemExit) as excinfo: - a2a_mcp_server._assert_stdio_is_pipe_compatible( + _assert_stdio_is_pipe_compatible( stdin_fd=f.fileno(), stdout_fd=w ) assert excinfo.value.code == 2 @@ -801,13 +801,13 @@ class TestStdioPipeAssertion: """If stdio is closed (rare but seen in detached daemonized contexts), os.fstat raises OSError. We catch it and exit 2 with a guidance message instead of letting the traceback escape.""" - import a2a_mcp_server + from a2a_mcp_server import _assert_stdio_is_pipe_compatible r, w = os.pipe() os.close(w) # Now `w` is a stale fd — fstat will fail. try: with pytest.raises(SystemExit) as excinfo: - a2a_mcp_server._assert_stdio_is_pipe_compatible( + _assert_stdio_is_pipe_compatible( stdin_fd=r, stdout_fd=w ) assert excinfo.value.code == 2