mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-03 06:08:15 +00:00
29 lines
771 B
Python
29 lines
771 B
Python
from __future__ import annotations
|
|
|
|
import socket
|
|
from typing import Any
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def public_example_dns(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
original_getaddrinfo = socket.getaddrinfo
|
|
|
|
def fake_getaddrinfo(
|
|
host: str, port: int, *args: Any, **kwargs: Any
|
|
) -> list[tuple[Any, ...]]:
|
|
if host in {"example.com", "api.example.com"}:
|
|
return [
|
|
(
|
|
socket.AF_INET,
|
|
socket.SOCK_STREAM,
|
|
6,
|
|
"",
|
|
("93.184.216.34", port),
|
|
)
|
|
]
|
|
return original_getaddrinfo(host, port, *args, **kwargs)
|
|
|
|
monkeypatch.setattr(socket, "getaddrinfo", fake_getaddrinfo)
|