-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] update how python tests are filtered and run on github #16814
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
base: trunk
Are you sure you want to change the base?
Conversation
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 ✨Latest suggestions up to 6f7fd0d
Previous suggestionsSuggestions up to commit 84bc272
|
||||||||||||||||||||||||||||
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 refactors how Python tests are filtered and executed in GitHub Actions CI to improve efficiency and granularity of test runs.
Key Changes:
- Transforms "remote" from a driver type to a command-line flag (
--remote), allowing any browser to run tests against a Selenium Grid - Enhances
check-bazel-targets.shto intelligently filter test targets based on changed files, enabling targeted test execution - Modifies CI workflows to conditionally run full test suites (docs, typing, unit tests) only when explicitly requested or when
[py]tag is present, while always running affected browser tests
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/github-actions/check-bazel-targets.sh |
Improved Bazel target detection with better error handling and filtering logic for test targets across bindings |
py/conftest.py |
Removed "remote" as a driver type and added --remote flag; updated fixtures to support running any browser remotely |
py/BUILD.bazel |
Refactored remote test targets to generate separate test-<browser>-remote targets for chrome and firefox instead of a single generic remote target |
.github/workflows/ci.yml |
Added targets and run-full-suite parameters to the Python workflow call for conditional test execution |
.github/workflows/ci-python.yml |
Added input handling, target filtering job, and updated browser test matrix to use tag-based filtering with targeted test execution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
10afc7c to
6f7fd0d
Compare
|
I think the Remote tests on RBE are failing because it can't find the JRE to launch the grid server. The That just looks for |
|
that makes sense why it was skip-rbe, then, I was just checking. :) |
|
@cgoldberg I think this is a "real" failure and that the current test isn't testing what you intended? |
I'm not sure why it's failing here, and we haven't seen this before. But I think the test is legit... it's just too strict, and some other socket error may occur so I think we can just assert than any HTTP error is raised by I would change the import from : to then inside the to Want me to fix it, or do you want to do it in this PR? |
|
Actually, I just looked at it again.. I think that specific test is probably fine. It should fail, and so should every other test in that file because it couldn't reach the Grid server? or maybe this is a different issue just with that proxy test? Something doesn't look right. |
|
No, it can reach grid; it is the only test failing (everything else is properly using the grid with this code). Maybe I don't understand the purpose of the test as written in trunk. It is using the http server for our test pages and passing its address to the remote driver. I don't think that's correct, so I don't think it should be passing in trunk. At least when I rewire it to use a grid server, it isn't doing what I think it should be doing. What is it supposed to be doing? |
|
(the rbe failures are different, I'm investigating separately) |
|
oh yeah.. I see that now.. it should be using the grid server address/port in ClientConfig, not the test web server. The test below it in that file has the same issue. the We should change those tests to use the grid server address/port, and raise the correct exception if an HTTP timeout occurs. |
|
This PR adds that logic for the server. The problem is that I think the http config is supposed to tell the driver to use that address, but it does not, it still needs remote_connection. At least, that's my expectation for what http config is supposed to do. |
User description
🔗 Related Issues
Python implementation of #16809
We are mostly relying on RBE to tell us if there is a problem, this is supposed to be extra information that strikes a good balance between information and execution time.
💥 What does this PR do?
First, I made it so that remote isn't tied to one browser. Bazel supports chrome and firefox, but this is quickly adjustable
ci.ymlkicks off on every commit. It runs the new and improvedcheck-bazel-targets.shInstead of just checking to see if there are any
pytargets and running the whole ci-python workflow, the unique set of applicable test targets are passed from the script toci-python.ymland browser tests are only run on thoseAdditionally, docs/steep/unit tests are only run if the PR includes "[py]" or is executed manually (passed into
ci-python.ymlfromci.ymlwith arun-full-suiteargument.Even if tagged
[py], if only a subset of python tests are matched, only those will be runRemoved build instead of gating all tests on it. Most of the build is executed by the applicable tests as necessary. If there is something weird that breaks building, it'll get detected in nightly run
As far as browser tests changed, it removes the edge tests for now for consistency with other bindings
💡 Additional Considerations
We may want to filter this further, and I'd like to add testing on beta versions of chrome/firefox
Is there a reason why the remote tests are running on Windows and not in RBE? Can we remove
skip-rbeand try to run more things in RBE?PR Type
Enhancement, Tests
Description
Decouple remote testing from specific browser driver
Filter Python tests by affected files in CI workflow
Conditionally run docs/typing/unit tests on [py] tag
Generate separate remote test targets for Chrome and Firefox
Remove build job dependency from test execution
Diagram Walkthrough
File Walkthrough
conftest.py
Decouple remote testing from driver classpy/conftest.py
remotefrom static drivers list and added--remotecommand-line option
is_remoteproperty
_initialize_driver()to usewebdriver.Remote()when--remoteflag is set
firefox_optionsandchromium_optionstocheck
--remoteflag instead of driver classSupportedBidiDrivers.remoteentrycheck-bazel-targets.sh
Improve target filtering with universe limitsscripts/github-actions/check-bazel-targets.sh
set -euo pipefailBINDINGS_UNIVERSEvariable
ci-python.yml
Refactor CI workflow with conditional test execution.github/workflows/ci-python.yml
targetsandrun-full-suiteparametersrun-full-suiteinputfilter-targetsjob to filter targets for Pythontest-remotewithtest-chrome-remoteandtest-firefox-remotetargets
[chrome, firefox, chrome-bidi, edge]to[chrome, firefox, chrome-bidi, chrome-remote]targets
ci.yml
Add target filtering to Python workflow trigger.github/workflows/ci.yml
targetsandrun-full-suiteoutputs from check job to Pythonworkflow
run-full-suiteto true only for scheduled runs, manual dispatch,or
[py]tag in PR title[py]tagBUILD.bazel
Generate per-browser remote test targetspy/BUILD.bazel
test-remotetarget with generated targets for Chromeand Firefox
--remoteflag to test arguments instead of--driver=remotetargets
chrome-remoteandfirefox-remotefor test selection