Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@
# copy bundled in the wheel instead. It is read once at import, so it is set
# here at conftest load, before any test can import litellm.
os.environ.setdefault("LITELLM_LOCAL_MODEL_COST_MAP", "True")
# CrewAI exports anonymous usage telemetry from a background thread. Under a
# test's dead proxy that thread opens a socket while ``no_sockets`` patches
# ``socket.connect`` process-wide, so an offline-seam test failed on CrewAI's
# traffic, not ours, whenever the export landed in its window (#1202).
# ``OTEL_SDK_DISABLED`` would also work but is cleared per test with the other
# ``OTEL_*`` vars; this switch is CrewAI's own and is read on every export.
os.environ.setdefault("CREWAI_DISABLE_TELEMETRY", "true")


def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
Expand Down
8 changes: 8 additions & 0 deletions python/tests/unit/test_transport_proxy_mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,11 @@ def test_swap_refuses_when_a_mount_could_bypass_it(make: object) -> None:
client._mounts = {URLPattern("all://"): httpx.MockTransport(lambda r: httpx.Response(200))}
with pytest.raises(RuntimeError, match="mounts that would bypass it"):
client.governed_transport.replace_inner(httpx.MockTransport(lambda r: httpx.Response(200)))


def test_crewai_telemetry_is_off_for_the_suite() -> None:
"""``no_sockets`` patches ``socket.connect`` process-wide, so CrewAI's
background telemetry export failed these tests at random (#1202). The
conftest switch turns it off; this fails if CrewAI stops honouring it."""
telemetry = pytest.importorskip("crewai.telemetry.telemetry")
assert telemetry.Telemetry._is_telemetry_disabled()
Loading