self = <test_envs.tests.unittest.ct_framework.python.test_mcp_runner.MCPServerContractTests testMethod=test_stdio_client_launches_external_server_process>
@unittest.skipUnless(
os.getenv("AI_CT_RUN_STDIO_TEST", "false").lower() == "true",
"set AI_CT_RUN_STDIO_TEST=true to launch the external stdio process",
)
async def test_stdio_client_launches_external_server_process(self) -> None:
parameters = StdioServerParameters(
command=sys.executable,
args=["-m", "test_envs.mcp_server"],
cwd=os.getcwd(),
env={"PYTEST_HIL_ALLOW": "false", "MKDOC_UPDATE": "false"},
)
> async with Client(parameters) as client:
^^^^^^^^^^^^^^^^^^
test_envs\tests\unittest\ct_framework\python\test_mcp_runner.py:111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv\Lib\site-packages\mcp\client\client.py:459: in __aenter__
session = await self._build_session(exit_stack)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\mcp\client\client.py:432: in _build_session
dispatcher = await self._connect(exit_stack, self.mode, self.raise_exceptions)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\mcp\client\client.py:102: in connect
read_stream, write_stream = await exit_stack.enter_async_context(transport)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C:\Python314\Lib\contextlib.py:668: in enter_async_context
result = await _enter(cm)
^^^^^^^^^^^^^^^^
C:\Python314\Lib\contextlib.py:214: in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\mcp\client\stdio.py:126: in stdio_client
process = await _create_platform_compatible_process(
.venv\Lib\site-packages\mcp\client\stdio.py:341: in _create_platform_compatible_process
return await create_windows_process(command, args, env, errlog, cwd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\mcp\os\win32\utilities.py:156: in create_windows_process
process = await anyio.open_process(
.venv\Lib\site-packages\anyio\_core\_subprocesses.py:184: in open_process
return await get_async_backend().open_process(
.venv\Lib\site-packages\anyio\_backends\_asyncio.py:2810: in open_process
transport, protocol = await loop.subprocess_exec(
C:\Python314\Lib\asyncio\base_events.py:1798: in subprocess_exec
transport = await self._make_subprocess_transport(
C:\Python314\Lib\asyncio\windows_events.py:401: in _make_subprocess_transport
transp = _WindowsSubprocessTransport(self, protocol, args, shell,
C:\Python314\Lib\asyncio\base_subprocess.py:40: in __init__
self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
C:\Python314\Lib\asyncio\windows_events.py:879: in _start
self._proc = windows_utils.Popen(
C:\Python314\Lib\asyncio\windows_utils.py:136: in __init__
stdin_rh, stdin_wh = pipe(overlapped=(False, True), duplex=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def pipe(*, duplex=False, overlapped=(True, True), bufsize=BUFSIZE):
"""Like os.pipe() but with overlapped support and using handles not fds."""
address = tempfile.mktemp(
prefix=r'\\.\pipe\python-pipe-{:d}-{:d}-'.format(
os.getpid(), next(_mmap_counter)))
if duplex:
openmode = _winapi.PIPE_ACCESS_DUPLEX
access = _winapi.GENERIC_READ | _winapi.GENERIC_WRITE
obsize, ibsize = bufsize, bufsize
else:
openmode = _winapi.PIPE_ACCESS_INBOUND
access = _winapi.GENERIC_WRITE
obsize, ibsize = 0, bufsize
openmode |= _winapi.FILE_FLAG_FIRST_PIPE_INSTANCE
if overlapped[0]:
openmode |= _winapi.FILE_FLAG_OVERLAPPED
if overlapped[1]:
flags_and_attribs = _winapi.FILE_FLAG_OVERLAPPED
else:
flags_and_attribs = 0
h1 = h2 = None
try:
h1 = _winapi.CreateNamedPipe(
address, openmode, _winapi.PIPE_WAIT,
1, obsize, ibsize, _winapi.NMPWAIT_WAIT_FOREVER, _winapi.NULL)
> h2 = _winapi.CreateFile(
address, access, 0, _winapi.NULL, _winapi.OPEN_EXISTING,
flags_and_attribs, _winapi.NULL)
E PermissionError: [WinError 5] 액세스가 거부되었습니다
C:\Python314\Lib\asyncio\windows_utils.py:63: PermissionError