-
Notifications
You must be signed in to change notification settings - Fork 25
feat: mark all integration tests as flaky with auto-retry #87
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
Conversation
📝 WalkthroughWalkthroughA pytest hook is added to centrally mark integration tests for automatic retries with flakiness tolerance, while individual flaky decorators are removed from specific integration tests to eliminate redundancy. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR centralizes the flaky test marker configuration by implementing a pytest hook in the integration test conftest.py file, which automatically marks all integration tests as flaky with 9 retries and a 1-second delay between retries.
- Adds a
pytest_collection_modifyitemshook to automatically mark all integration tests as flaky - Removes individual
@pytest.mark.flakydecorators from specific test methods in the WebSocket integration tests
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/integration/conftest.py | Implements a pytest hook to automatically apply the flaky marker to all tests in the integration directory |
| tests/integration/test_tts_websocket_integration.py | Removes two individual flaky decorators from test methods, now covered by the centralized hook |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/integration/conftest.py (1)
16-21: Refine the path check and add type hints.The centralized approach to marking integration tests as flaky is excellent. The
pytest-rerunfailuresdependency is already included in yourdevdependencies. However, two refinements would improve the code:
- Path matching robustness: The substring check
"integration" in str(item.fspath)could unintentionally match other paths like tests named "integration-feature" elsewhere in the codebase. Use a more explicit check:♻️ Suggested improvements
# Option 1: Check for the specific directory if "tests/integration" in str(item.fspath).replace("\\", "/"): item.add_marker(pytest.mark.flaky(reruns=9, reruns_delay=1)) # Option 2: Use pathlib for cross-platform robustness (Path is already imported) from pathlib import Path if "integration" in Path(str(item.fspath)).parts: item.add_marker(pytest.mark.flaky(reruns=9, reruns_delay=1))
- Type hints: Add type hints to the
itemsparameter and return type for better code clarity:def pytest_collection_modifyitems(items: list) -> None:
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
tests/integration/conftest.pytests/integration/test_tts_websocket_integration.py
💤 Files with no reviewable changes (1)
- tests/integration/test_tts_websocket_integration.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Integration Tests
- GitHub Check: Integration Tests
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.