Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flakey test by allowing arbitrary warnings during capture #3282

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading