Skip to content

Commit

Permalink
Fix flakey test by allowing arbitrary warnings during capture (boto#3282
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nateprewitt authored and hswong3i committed Oct 22, 2024
1 parent feac226 commit 2c1eb36
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/unit/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,16 +429,17 @@ def assert_tagged_union_response_with_unknown_member(
expected_parsed_response,
expected_log,
):
warning_message = (
'Received a tagged union response with member unknown to client'
)
with self.assertLogs() as captured_log:
parsed = parser.parse(response, output_shape)
self.assertEqual(parsed, expected_parsed_response)
self.assertEqual(len(captured_log.records), 1)
self.assertIn(
(
'Received a tagged union response with member '
'unknown to client'
),
captured_log.records[0].getMessage(),
log_messages = [
record.getMessage() for record in captured_log.records
]
self.assertTrue(
any(warning_message in log for log in log_messages)
)

def test_base_json_parser_handles_unknown_member(self):
Expand Down

0 comments on commit 2c1eb36

Please sign in to comment.