Skip to content

fix: flaky test in test_data_validator #927

Merged
AlexanderFengler merged 2 commits intomainfrom
fix/flaky-data-validator-test
Mar 12, 2026
Merged

fix: flaky test in test_data_validator #927
AlexanderFengler merged 2 commits intomainfrom
fix/flaky-data-validator-test

Conversation

@krishnbera
Copy link
Copy Markdown
Collaborator

…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.

…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
Copilot AI review requested due to automatic review settings March 10, 2026 20:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) when choices=[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.

Copy link
Copy Markdown
Member

@AlexanderFengler AlexanderFengler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@krishnbera
Copy link
Copy Markdown
Collaborator Author

@AlexanderFengler feel free to review and merge

Copy link
Copy Markdown
Member

@AlexanderFengler AlexanderFengler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks @krishnbera

@AlexanderFengler AlexanderFengler merged commit 1e70a6d into main Mar 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants