[py] Fix driver class name in test fixtures #15550
Merged
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.
User description
Motivation and Context
This PR fixes some issues in the Python test configuration (PyTest fixtures).
Before this fix, running tests that use the
clean_driver
orclean_service
fixture would fail when using certain--driver
options.If
--driver
option was not included, the tests would fail with:TypeError: 'NoneType' object is not subscriptable
Now they correctly fail with:
Exception: This test requires a --driver to be specified
If
--driver=webkitgtk
or--driver=wpewebkit
was used, tests would fail with:AttributeError: module 'selenium.webdriver' has no attribute 'Webkitgtk'. Did you mean: 'webkitgtk'?
or
AttributeError: module 'selenium.webdriver' has no attribute 'Wpewebkit'. Did you mean: 'wpewebkit'?
Now the tests can be executed using these options.
This PR also fixes an issue where WebKitGTK and WPEWebKit tests were not skipped on non-Linux platforms.
Types of changes
Checklist
PR Type
Bug fix
Description
Fixed incorrect driver class name generation in test fixtures.
Added
get_driver_class
function for consistent driver class handling.Improved error handling for missing or invalid
--driver
options.Enhanced compatibility with
webkitgtk
andwpewebkit
drivers.Changes walkthrough 📝
conftest.py
Refactored driver class handling and improved error messages
py/conftest.py
get_driver_class
function to generate driver class names.clean_service
andclean_driver
fixtures to useget_driver_class
.--driver
options.webkitgtk
andwpewebkit
driver options.