MCPcopy Create free account
hub / github.com/anomalyco/opencode-sdk-python / async_client

Function async_client

tests/conftest.py:60–80  ·  view source on GitHub ↗
(request: FixtureRequest)

Source from the content-addressed store, hash-verified

58
59@pytest.fixture(scope="session")
60async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncOpencode]:
61 param = getattr(request, "param", True)
62
63 # defaults
64 strict = True
65 http_client: None | httpx.AsyncClient = None
66
67 if isinstance(param, bool):
68 strict = param
69 elif is_dict(param):
70 strict = param.get("strict", True)
71 assert isinstance(strict, bool)
72
73 http_client_type = param.get("http_client", "httpx")
74 if http_client_type == "aiohttp":
75 http_client = DefaultAioHttpClient()
76 else:
77 raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict")
78
79 async with AsyncOpencode(base_url=base_url, _strict_response_validation=strict, http_client=http_client) as client:
80 yield client

Callers

nothing calls this directly

Calls 3

is_dictFunction · 0.90
AsyncOpencodeClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected