MCPcopy
hub / github.com/openai/openai-python / pytest_collection_modifyitems

Function pytest_collection_modifyitems

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

Source from the content-addressed store, hash-verified

24# automatically add `pytest.mark.asyncio()` to all of our async tests
25# so we don't have to add that boilerplate everywhere
26def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
27 pytest_asyncio_tests = (item for item in items if is_async_test(item))
28 session_scope_marker = pytest.mark.asyncio(loop_scope="session")
29 for async_test in pytest_asyncio_tests:
30 async_test.add_marker(session_scope_marker, append=False)
31
32 # We skip tests that use both the aiohttp client and respx_mock as respx_mock
33 # doesn't support custom transports.
34 for item in items:
35 if "async_client" not in item.fixturenames or "respx_mock" not in item.fixturenames:
36 continue
37
38 if not hasattr(item, "callspec"):
39 continue
40
41 async_client_param = item.callspec.params.get("async_client")
42 if is_dict(async_client_param) and async_client_param.get("http_client") == "aiohttp":
43 item.add_marker(pytest.mark.skip(reason="aiohttp client is not compatible with respx_mock"))
44
45
46base_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