fix: flaky test in test_data_validator #927
Merged
AlexanderFengler merged 2 commits intomainfrom Mar 12, 2026
Merged
Conversation
…range The test sets choices=[0, 1, 2] but picks a supposedly invalid response from range(2, 100). When random.choice returns 2, the response is actually valid and no ValueError is raised, causing a flaky failure. Changed to range(3, 100) to guarantee an invalid choice. Made-with: Cursor
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a flaky DataValidatorMixin sanity-check test by ensuring the generated “invalid response” value cannot overlap with the configured valid choices.
Changes:
- Adjusted the invalid-response generator to use
range(3, 100)whenchoices=[0, 1, 2], guaranteeing an invalid value and eliminating flaky outcomes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AlexanderFengler
requested changes
Mar 10, 2026
Member
AlexanderFengler
left a comment
There was a problem hiding this comment.
Could you just quickly address the copilot comments, since I think they do point out remaining weaknesses in the test. Then good to go. Thanks @krishnbera
Use a deterministic invalid response value and explicit response-column indexing to remove flaky randomness and schema-order brittleness in test_data_validator. Made-with: Cursor
Collaborator
Author
|
@AlexanderFengler feel free to review and merge |
AlexanderFengler
approved these changes
Mar 12, 2026
Member
AlexanderFengler
left a comment
There was a problem hiding this comment.
lgtm, thanks @krishnbera
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…range
The test sets choices=[0, 1, 2] but picks a supposedly invalid response from range(2, 100). When random.choice returns 2, the response is actually valid and no ValueError is raised, causing a flaky failure. Changed to range(3, 100) to guarantee an invalid choice.