From 661bccbc3984396b13900ee9069754dca244e83d Mon Sep 17 00:00:00 2001 From: Colin Lin Date: Mon, 1 Dec 2025 14:15:54 -0500 Subject: [PATCH] fixed flaky test by sorting list --- .../llms/bedrock/test_anthropic_beta_support.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py b/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py index bd64670517c..7de2294954c 100644 --- a/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py +++ b/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py @@ -80,7 +80,8 @@ class TestAnthropicBetaHeaderSupport: assert "additionalModelRequestFields" in result additional_fields = result["additionalModelRequestFields"] assert "anthropic_beta" in additional_fields - assert additional_fields["anthropic_beta"] == ["context-1m-2025-08-07", "interleaved-thinking-2025-05-14"] + # Sort both arrays before comparing to avoid flakiness from ordering differences + assert sorted(additional_fields["anthropic_beta"]) == sorted(["context-1m-2025-08-07", "interleaved-thinking-2025-05-14"]) def test_messages_transformation_anthropic_beta(self): """Test that Messages API transformation includes anthropic_beta in request.""" @@ -96,7 +97,8 @@ class TestAnthropicBetaHeaderSupport: ) assert "anthropic_beta" in result - assert result["anthropic_beta"] == ["output-128k-2025-02-19"] + # Sort both arrays before comparing to avoid flakiness from ordering differences + assert sorted(result["anthropic_beta"]) == sorted(["output-128k-2025-02-19"]) def test_converse_computer_use_compatibility(self): """Test that user anthropic_beta headers work with computer use tools.""" @@ -287,4 +289,4 @@ class TestAnthropicBetaHeaderSupport: assert "prompt-caching-2024-07-31" not in result["anthropic_beta"] else: # If no beta headers, that's also fine - assert True \ No newline at end of file + assert True