You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
py: Remove redundant driver_instance from conftest.py
Currently, the driver lifetime is handled by two global variables:
- `driver_instance`, the actual Selenium API driver.
- `selenium_driver`, the wrapper `conftest.Driver`, which "owns" the
former.
Also, conftest.py could quit the driver from multiple places:
- `Driver.stop_driver` finalizer, used for bidi and xfail tests
- `stop_driver` Session-scope fixture finalizer
- `pytest_exception_interact` to handle exceptions
The last two paths called `driver_instance.quit()` directly but did
not tell `selenium_driver` that the driver had exited. This could
potentially raise `urllib.exception.MaxRetryError`, as
`Driver.stop_driver` would try to send the `quit()` command to an
already destroyed driver service.
For example, this happened rather frequently on WebKit import of
selenium 4.34.2 tests, whenever an exception happened, as we have
enabled the `bidi` flag when calling pytest.
To address this issue, this commit removes the global variable
`driver_instance`, keeping only `selenium_driver` as global,
and routes all teardown paths through `Driver.stop_driver()`.
0 commit comments