Home / Function/ pytest_collection_modifyitems() — anthropic-sdk-python Function Reference

pytest_collection_modifyitems() — anthropic-sdk-python Function Reference

Architecture documentation for the pytest_collection_modifyitems() function in conftest.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  d7a42695_c131_0c73_7e73_fc4ef59f2b2d["pytest_collection_modifyitems()"]
  68a6e880_ca4a_fcf0_511e_42d9fe42570f["conftest.py"]
  d7a42695_c131_0c73_7e73_fc4ef59f2b2d -->|defined in| 68a6e880_ca4a_fcf0_511e_42d9fe42570f
  style d7a42695_c131_0c73_7e73_fc4ef59f2b2d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/conftest.py lines 26–43

def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
    pytest_asyncio_tests = (item for item in items if is_async_test(item))
    session_scope_marker = pytest.mark.asyncio(loop_scope="session")
    for async_test in pytest_asyncio_tests:
        async_test.add_marker(session_scope_marker, append=False)

    # We skip tests that use both the aiohttp client and respx_mock as respx_mock
    # doesn't support custom transports.
    for item in items:
        if "async_client" not in item.fixturenames or "respx_mock" not in item.fixturenames:
            continue

        if not hasattr(item, "callspec"):
            continue

        async_client_param = item.callspec.params.get("async_client")
        if is_dict(async_client_param) and async_client_param.get("http_client") == "aiohttp":
            item.add_marker(pytest.mark.skip(reason="aiohttp client is not compatible with respx_mock"))

Subdomains

Defined In

Frequently Asked Questions

What does pytest_collection_modifyitems() do?
pytest_collection_modifyitems() is a function in the anthropic-sdk-python codebase, defined in tests/conftest.py.
Where is pytest_collection_modifyitems() defined?
pytest_collection_modifyitems() is defined in tests/conftest.py at line 26.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free