Skip to content

Commit

Permalink
Fix flakey test by allowing arbitrary warnings during capture (#3282)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateprewitt authored Oct 18, 2024
1 parent 3cf5573 commit b90e353
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 b90e353

Please sign in to comment.