[py] wire print_pdf_tests.py into the browser test suites - #17976
Merged
Merged
Conversation
print_pdf_tests.py imports PrintOptions from its own library (:common_print_page_options), which was never added as a dependency of the test-<browser>-common targets, so the file was excluded from every glob() that feeds them instead. That left it excluded from Bazel's target graph entirely for chrome/edge/firefox/safari, and reachable-but-broken (ImportError on collection) for the webkitgtk/wpewebkit targets, which don't have the same exclude. Follow the existing feature-suite pattern (fedcm, timeouts, alerts, etc.) instead: carve print_pdf_tests.py out via PRINT_TESTS, fold it into FEATURE_TESTS so it's excluded from the common globs, and register it in FEATURE_SUITE_DEFS so per-browser and per-browser remote targets are generated with the :common_print_page_options dep. Verified locally with `bazel test`: 4/4 pass on chrome, firefox and edge (both local and remote variants); safari correctly xfails via the existing @pytest.mark.xfail_safari markers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kEM1tVUYCgzyhJ5xmseyF
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
This was referenced Sep 9, 2026
This was referenced Sep 14, 2026
Merged
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🔗 Related Issues
Addresses the second half of #17975 (
print_pdf_tests.pyunreachable from any Bazel target).💥 What does this PR do?
py/test/selenium/webdriver/common/print_pdf_tests.py(4 tests) was excluded from everytest-<browser>-common/test-<browser>-remote-commonglob via an explicitexclude=[...]entry, and was never included in any other target, so it never ran in CI for chrome/edge/firefox/safari.Root cause:
PrintOptionswas carved out into its ownpy_library(:common_print_page_options,py/BUILD.bazel:384) — the same pattern used foralert.py,fedcm/,timeouts.py, etc. — but, unlike those,print_pdf_tests.pywas never registered inFEATURE_SUITE_DEFS. It was instead just excluded outright, presumably because the file would otherwise fail to collect (ModuleNotFoundError: No module named 'selenium.webdriver.common.print_page_options') in the common suite, which doesn't depend on that library.This also meant the
webkitgtk/wpewebkittargets — which don't carry the same explicit exclude — silently included the file without the required dependency, so//py:test/selenium/webdriver/common/print_pdf_tests-webkitgtkand-wpewebkitexisted in the build graph but would fail on collection if anyone ever ran them (nothing in CI does).Fix: follow the existing feature-suite pattern instead of excluding outright — add
PRINT_TESTS, fold it intoFEATURE_TESTS(so it's excluded from the common globs, same asalerts/fedcm/etc.), and register"print": (PRINT_TESTS, ":common_print_page_options")inFEATURE_SUITE_DEFS. This generatestest-<browser>-printandtest-<browser>-remote-printtargets with the correct dependency, wired into the existingtest-<browser>/test-<browser>-remoteaggregates and the webkitgtk/wpewebkit suites, same as every other feature.🔧 Implementation Notes
:common_print_page_optionsdirectly to:common's deps instead, but that would pull it into every browser test target regardless of whether it's needed, going against the existing convention (eachcommon_*library exists specifically so unrelated targets aren't invalidated by changes to it — see the comment atpy/BUILD.bazel:860-862).PrintPageTest.java), .NET (PrintTests.cs), Ruby (print_options_spec.rb) and JS (print_pdf_test.js) all have an equivalent test that runs normally in CI, so Python was the outlier here.bazel test(JDK/output-base overrides omitted below for brevity)://py:test/selenium/webdriver/common/print_pdf_tests-chrome-print— 4/4 passed//py:test/selenium/webdriver/common/print_pdf_tests-firefox-print— 4/4 passed//py:test/selenium/webdriver/common/print_pdf_tests-edge-print— 4/4 passed//py:test/selenium/webdriver/common/print_pdf_tests-safari-print— 4/4 xfail (existing@pytest.mark.xfail_safarimarkers, expected)//py:test/selenium/webdriver/common/print_pdf_tests-chrome-remote-printand-firefox-remote-print— both passedie_launcher_tests.py(the other file flagged in Python unit tests do not run on pull requests — intended? #17975) — that one traces back to a deliberate PR ([build] do not create targets for IE for browser tests #17548) removing IE test-target generation as IE support is being phased out, so it's a separate, intentional situation rather than an oversight.🤖 AI assistance
bazel query/bazel test, diagnosed the missing:common_print_page_optionsdependency, and wrote theBUILD.bazelfix following the existingFEATURE_SUITE_DEFSpattern.💡 Additional Considerations
None — this only changes which existing, already-passing tests are wired into the build graph; no test or production code was modified.
🔄 Types of changes