[py] Extract feature-specific modules from //py:common (#17606)
* [py] Extract feature-specific modules from //py:common (P2b/P2d)
Modules that are only used by a small subset of tests were still bundled
in //py:common, causing those modules to be compiled into every test's
transitive dep graph. Changing any of them triggered a full rebuild of
all ~700 browser test targets.
This change extracts five modules into dedicated libraries:
- //py:common_fedcm (fedcm/**/*.py)
- //py:common_timeouts (timeouts.py)
- //py:common_virtual_authenticator (virtual_authenticator.py)
- //py:common_api_request_context (api_request_context.py)
- //py:common_print_page_options (print_page_options.py)
For each module, the corresponding browser test file (e.g. timeout_tests.py,
virtual_authenticator_tests.py) is the only test that imports it directly.
New per-feature test sub-suites (test-chrome-timeouts, test-chrome-fedcm,
etc.) carry the right //py:common_* dep; the -common suites have no dep
on these libraries. Aggregate test_suite targets (test-chrome, test-chrome-bidi,
test-chrome-remote, etc.) are unchanged so CI targets are unaffected.
For the split to be precise, remote/webdriver.py previously imported these
modules at the top level, which would have re-added them to every test's
dep graph via //py:remote. Three changes remove this:
- from __future__ import annotations makes all type annotations lazy
strings, so no runtime import is needed for parameter/return types.
- The four methods that instantiate these types (timeouts property,
request property, dialog property, get_credentials) now lazy-import
inside the method body.
- The required_virtual_authenticator and required_chromium_based_browser
decorators are inlined in remote/webdriver.py (they were only used
there; the 10-line definition removes the top-level dep).
Result: changing timeouts.py now only rebuilds ~11 test targets
(timeout_tests × browser variants) instead of ~700. D
David Burns committed
e4eac88dbdda194694c73679759b75af231ae869
Parent: 2eaf118
Committed by GitHub <noreply@github.com>
on 6/1/2026, 6:35:51 PM