8000 test: set OTEL_ env vars correctly for tests (#169) · jer96/sdk-python@da55dc8 · GitHub
[go: up one dir, main page]

Skip to content

Commit da55dc8

Browse files
authored
test: set OTEL_ env vars correctly for tests (strands-agents#169)
1 parent 76cd7ba commit da55dc8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def moto_env(monkeypatch):
2424
monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "test")
2525
monkeypatch.setenv("AWS_SECURITY_TOKEN", "test")
2626
monkeypatch.setenv("AWS_DEFAULT_REGION", "us-west-2")
27+
monkeypatch.delenv("OTEL_EXPORTER_OTLP_ENDPOINT", raising=False)
28+
monkeypatch.delenv("OTEL_EXPORTER_OTLP_HEADERS", raising=False)
2729

2830

2931
@pytest.fixture

tests/strands/tools/test_executor.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import concurrent
22
import functools
33
import unittest.mock
4+
import uuid
45

56
import pytest
67

@@ -9,6 +10,11 @@
910
from strands.types.content import Message
1011

1112

13+
@pytest.fixture(autouse=True)
14+
def moto_autouse(moto_env):
15+
_ = moto_env
16+
17+
1218
@pytest.fixture
1319
def tool_handler(request):
1420
def handler(tool_use):
@@ -52,10 +58,10 @@ def invalid_tool_use_ids(request):
5258
return request.param if hasattr(request, "param") else []
5359

5460

55-
@unittest.mock.patch.object(strands.telemetry.metrics, "uuid4", return_value="trace1")
5661
@pytest.fixture
5762
def cycle_trace():
58-
return strands.telemetry.metrics.Trace(name="test trace", raw_name="raw_name")
63+
with unittest.mock.patch.object(uuid, "uuid4", return_value="trace1"):
64+
return strands.telemetry.metrics.Trace(name="test trace", raw_name="raw_name")
5965

6066

6167
@pytest.fixture

0 commit comments

Comments
 (0)
0