-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] Make extensions tests work when not running bazel #17026
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
PR TypeBug fix, Tests Description
|
| Relevant files | |||||
|---|---|---|---|---|---|
| Enhancement |
| ||||
| Bug fix |
| ||||
| Formatting |
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||
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 enables Python extension tests to run outside of the Bazel build system by adding a fallback mechanism for locating test extensions. It also fixes import ordering detection issues with ruff and excludes auto-generated devtools files from linting.
Changes:
- Added
get_extensions_location()function to locate extensions via Runfiles when using Bazel or via local source tree otherwise - Fixed import ordering to place
conftestimports after first-party imports (selenium, test) - Configured ruff isort with
known-local-folder = ["conftest"]to properly detect import ordering issues - Excluded
common/devtools/directory from ruff linting
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| py/conftest.py | Added get_extensions_location() helper function that uses Runfiles when available or falls back to local path |
| py/test/selenium/webdriver/firefox/firefox_profile_tests.py | Reordered imports to place conftest import after selenium imports |
| py/test/selenium/webdriver/firefox/ff_installs_addons_tests.py | Replaced direct Runfiles usage with get_extensions_location() function |
| py/test/selenium/webdriver/common/bidi_webextension_tests.py | Replaced direct Runfiles usage with get_extensions_location() function |
| py/pyproject.toml | Added ruff isort configuration for known-local-folder to fix import ordering detection |
| py/private/ruff_check.py | Added devtools exclusion to prevent linting third-party protocol files |
navin772
left a comment
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.
LGTM!
Nice work
💥 What does this PR do?
This PR allows extensions tests to work when not running bazel.
Currently, there are 2 test files that use bazel Runfiles to locate web extensions when running tests. If you try to run these directly with pytest (without bazel), they will fail because Runfiles doesn't exist.
This PR adds a function to locate extensions in the local source tree when Runfiles isn't installed, and updates tests to use it for locating extensions.
This also fixes a subtle bug where the new
ruff-check.pywas giving incorrect results when finding import ordering issues.It also skips
devtoolswhen runningruff-check.pyandruff-format.pyfrom bazel.🔄 Types of changes