MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / pytest_collection_modifyitems

Function pytest_collection_modifyitems

tests/conftest.py:40–57  ·  view source on GitHub ↗
(items: list[pytest.Function])

Source from the content-addressed store, hash-verified

38# automatically add `pytest.mark.asyncio()` to all of our async tests
39# so we don't have to add that boilerplate everywhere
40def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
41 pytest_asyncio_tests = (item for item in items if is_async_test(item))
42 session_scope_marker = pytest.mark.asyncio(loop_scope="session")
43 for async_test in pytest_asyncio_tests:
44 async_test.add_marker(session_scope_marker, append=False)
45
46 # We skip tests that use both the aiohttp client and respx_mock as respx_mock
47 # doesn't support custom transports.
48 for item in items:
49 if "async_client" not in item.fixturenames or "respx_mock" not in item.fixturenames:
50 continue
51
52 if not hasattr(item, "callspec"):
53 continue
54
55 async_client_param = item.callspec.params.get("async_client")
56 if is_dict(async_client_param) and async_client_param.get("http_client") == "aiohttp":
57 item.add_marker(pytest.mark.skip(reason="aiohttp client is not compatible with respx_mock"))
58
59
60base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

Callers

nothing calls this directly

Calls 2

is_dictFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected