Skip to content

Commit cbe166c

Browse files
authored
test(llmobs): fix unmigrated botocore test (#17874)
## Summary - `test_llmobs_converse_guard_content_text` has been failing on `main` since #17801 merged. It was overlooked by that PR's migration: the test still uses the old `llmobs_events` fixture but never pulls in `bedrock_llmobs`, so LLMObs is never enabled and `len(llmobs_events) == 1` fails with `0 == 1`. - Pre-#17801, `llmobs_events` transitively depended on `bedrock_llmobs` (the fixture wired LLMObs + the test span writer). The new conftest dropped that link, and every other test in `TestLLMObsBedrock` was rewritten to take `bedrock_llmobs` explicitly — except this one. - Migrate this test to the same pattern as the three nearby `test_llmobs_converse_tool_result_*` tests: `bedrock_llmobs` + `test_spans` + `get_llmobs_input_messages(spans[0])`. ## Test plan - [x] Ran the test locally on Python 3.10 / botocore 1.38.26 (the lowest pinned venv where `BOTO_VERSION >= (1, 34, 131)` so the `skipif` doesn't fire): passes. - [ ] CI green on the botocore suite. Claude session: `6d4c7e26-fb57-405b-9cd3-586ac14a911a` Resume: `claude --resume 6d4c7e26-fb57-405b-9cd3-586ac14a911a` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: yun.kim <yun.kim@datadoghq.com>
1 parent 27dab0c commit cbe166c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/contrib/botocore/test_bedrock_llmobs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ def test_llmobs_converse_tool_result_json_non_text_or_json(
673673
]
674674

675675
@pytest.mark.skipif(BOTO_VERSION < (1, 34, 131), reason="Converse API not available until botocore 1.34.131")
676-
def test_llmobs_converse_guard_content_text(self, bedrock_client, request_vcr, test_spans, llmobs_events):
676+
def test_llmobs_converse_guard_content_text(self, bedrock_client, bedrock_llmobs, test_spans):
677677
import botocore
678678

679679
with pytest.raises(botocore.exceptions.ClientError):
@@ -697,8 +697,9 @@ def test_llmobs_converse_guard_content_text(self, bedrock_client, request_vcr, t
697697
],
698698
)
699699

700-
assert len(llmobs_events) == 1
701-
assert llmobs_events[0]["meta"]["input"]["messages"] == [{"content": "give me my bill", "role": "user"}]
700+
spans = [s for trace in test_spans.pop_traces() for s in trace]
701+
assert len(spans) == 1
702+
assert get_llmobs_input_messages(spans[0]) == [{"content": "give me my bill", "role": "user"}]
702703

703704

704705
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)