[py] retry safaridriver startup in tests#17615
Conversation
Review Summary by QodoImplement SafariDriver startup retry mechanism and remove Safari 26.5 test guards
WalkthroughsDescription• Implement retry mechanism for SafariDriver startup to handle connection errors - Python: Added _start_local_driver() method with 3 retry attempts and 1s interval - Ruby: Moved test guards from describe blocks to individual test cases • Remove Safari 26.5 regression test guards across Python test suite - Removed @pytest.mark.xfail_safari decorators from 60+ test functions • Improve driver initialization robustness by recreating Service on each retry attempt Diagramflowchart LR
A["SafariDriver Startup"] --> B["Retry Loop<br/>3 attempts"]
B --> C["Create Service<br/>Get free port"]
C --> D["Initialize Driver"]
D -->|Success| E["Return Driver"]
D -->|WebDriverException| F["Log Warning"]
F --> G["Sleep 1s"]
G -->|Retry Available| B
G -->|Max Retries| H["Raise Exception"]
File Changes1. py/conftest.py
|
|
Thank you, @titusfortner for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
Code Review by Qodo
1.
|
|
Code review by qodo was updated up to the latest commit 1b2d4c9 |
🔗 Related Issues
#16768 (rb) and #17560 (py)
When Safari 26.5 was released ~May 20, the Python Safari job started consistently failing across multiple runs. When I ran the Ruby Safari tests, they were also failing, so I guarded everything.
Except things seem to be passing now, so I'm not sure what was going on previously. Some of those failures were connection related, so this PR addresses those.
💥 What does this PR do?
🔧 Implementation Notes
Driver._start_local_driver) attemptswebdriver.<Driver>(...)up toDRIVER_START_RETRIES(3) times with aDRIVER_START_INTERVAL(1s) pause, logging a warning (with the error) on each retry. TheServiceis recreated fromself.serviceon each attempt so a retry grabs a freshfree_port()and a clean subprocess rather than reusing a wedged one;self.servicealready resolves the correctServiceclass per driver.🤖 AI assistance
💡 Additional Considerations
rerun-with-debug) will show the start-up errors and confirm whether a stability fix beyond retries is still needed.🔄 Types of changes