|
6 | 6 | from agents.models.openai_chatcompletions import OpenAIChatCompletionsModel |
7 | 7 | from agents.models.openai_responses import OpenAIResponsesModel |
8 | 8 | from agents.run import set_default_agent_runner |
9 | | -from agents.tracing import set_trace_processors |
10 | | -from agents.tracing.setup import get_trace_provider |
| 9 | +from agents.tracing.provider import DefaultTraceProvider |
| 10 | +from agents.tracing.setup import set_trace_provider |
11 | 11 |
|
12 | 12 | from .testing_processor import SPAN_PROCESSOR_TESTING |
13 | 13 |
|
14 | 14 |
|
15 | 15 | # This fixture will run once before any tests are executed |
16 | 16 | @pytest.fixture(scope="session", autouse=True) |
17 | 17 | def setup_span_processor(): |
18 | | - set_trace_processors([SPAN_PROCESSOR_TESTING]) |
| 18 | + provider = DefaultTraceProvider() |
| 19 | + provider.set_processors([SPAN_PROCESSOR_TESTING]) |
| 20 | + set_trace_provider(provider) |
| 21 | + yield |
| 22 | + provider.shutdown() |
19 | 23 |
|
20 | 24 |
|
21 | 25 | # Ensure a default OpenAI API key is present for tests that construct clients |
@@ -51,13 +55,6 @@ def clear_default_runner(): |
51 | 55 | set_default_agent_runner(None) |
52 | 56 |
|
53 | 57 |
|
54 | | -# This fixture will run after all tests end |
55 | | -@pytest.fixture(autouse=True, scope="session") |
56 | | -def shutdown_trace_provider(): |
57 | | - yield |
58 | | - get_trace_provider().shutdown() |
59 | | - |
60 | | - |
61 | 58 | @pytest.fixture(autouse=True) |
62 | 59 | def disable_real_model_clients(monkeypatch, request): |
63 | 60 | # If the test is marked to allow the method call, don't override it. |
|
0 commit comments