Skip to content

Commit 8378c34

Browse files
committed
test: fix tests to skip when dependencies have not been installed
1 parent 3ba7270 commit 8378c34

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

tests/test_ai_integration_deactivation.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from sentry_sdk import get_client
44
from sentry_sdk.integrations import _INTEGRATION_DEACTIVATES
5-
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration
6-
from sentry_sdk.integrations.pydantic_ai import PydanticAIIntegration
75

86

97
try:
@@ -28,8 +26,29 @@
2826
has_anthropic = False
2927

3028

29+
try:
30+
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration
31+
32+
has_openai_agents = True
33+
except Exception:
34+
has_openai_agents = False
35+
36+
try:
37+
from sentry_sdk.integrations.pydantic_ai import PydanticAIIntegration
38+
39+
has_pydantic_ai = True
40+
except Exception:
41+
has_pydantic_ai = False
42+
43+
3144
pytestmark = pytest.mark.skipif(
32-
not (has_langchain and has_openai and has_anthropic),
45+
not (
46+
has_langchain
47+
and has_openai
48+
and has_anthropic
49+
and has_openai_agents
50+
and has_pydantic_ai
51+
),
3352
reason="Requires langchain, openai, and anthropic packages to be installed",
3453
)
3554

0 commit comments

Comments
 (0)