daavoo commited on
Commit
6df0226
ยท
1 Parent(s): c2fdfed

Add test_integration_openai

Browse files
tests/integration/agents/test_integration_openai.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pytest
3
+
4
+ from surf_spot_finder.agents.openai import run_openai_agent
5
+
6
+ INTEGRATION_MODEL = "gpt-4o-mini"
7
+ API_KEY_VAR = "OPENAI_API_KEY"
8
+
9
+
10
+ @pytest.mark.skipif(
11
+ "INTEGRATION_TESTS" not in os.environ,
12
+ reason="Integration tests require INTEGRATION_TESTS env var",
13
+ )
14
+ def test_openai_real_execution():
15
+ """
16
+ Tests the actual execution of the agent against real APIs.
17
+
18
+ WARNING: This will make actual API calls and incur costs.
19
+ Only run when explicitly needed for full system testing.
20
+
21
+ Requires:
22
+ - OPENAI_API_KEY in environment variables
23
+ - INTEGRATION_TESTS env var to be set
24
+ """
25
+ from agents import RunResult, ToolCallItem
26
+
27
+ result = run_openai_agent(
28
+ INTEGRATION_MODEL,
29
+ "What will be the best surf spot around Vigo, in a 2 hour driving radius, tomorrow?",
30
+ api_key_var=API_KEY_VAR,
31
+ )
32
+
33
+ assert isinstance(result, RunResult)
34
+ assert any(isinstance(item, ToolCallItem) for item in result.new_items)